Git Product home page Git Product logo

Comments (6)

Uzlopak avatar Uzlopak commented on June 16, 2024 3

I dont think so. Looking at the unit test, eta is wrong initialized.

It should be done like this according the unit tests:

const { Eta } = require('eta')
const path = require("path");
const app = require("fastify")();

app.register(require("@fastify/view"), {
  engine: {
    eta: new Eta(),
  },
  root: path.join(__dirname, "view"),
});

app.get("/", function (req, rep) {
  rep.view("index.eta");
});

app.listen({
  port: 3000,
  host: "127.0.0.1",
});

from point-of-view.

gurgunday avatar gurgunday commented on June 16, 2024 1

Yeah, this was not the case in v1/2 if I'm not mistaken

After v3, it ought to be initialized like how @Uzlopak did

It works on my end, feel free to comment if the issue persists

from point-of-view.

4e576rt8uh9ij9okp avatar 4e576rt8uh9ij9okp commented on June 16, 2024

I have the same issue here. I looked up and engine.configure actually exists in the code itself.

point-of-view/index.js

Lines 672 to 675 in db34d0e

engine.configure({
views: templatesDir || lru,
cache: prod || globalOptions.templatesSync
})

Prerequisites

 * [x]  I have written a descriptive issue title

 * [x]  I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.22.2

Plugin version

8.0.0

Node.js version

20.6.1

Operating system

Ubuntu Server LTS

Operating system version (i.e. 20.04, 11.3, 10)

22.04.3 LTS

from point-of-view.

Uzlopak avatar Uzlopak commented on June 16, 2024

Yeah but if eta does not have .configure than...

from point-of-view.

4e576rt8uh9ij9okp avatar 4e576rt8uh9ij9okp commented on June 16, 2024

Yeah but if eta does not have .configure than...

So eta broke the compatibility?

from point-of-view.

4e576rt8uh9ij9okp avatar 4e576rt8uh9ij9okp commented on June 16, 2024

Now I see it too lol

t.beforeEach(async t => {
// this is mandatory since some test call eta.configure(customOptions)
eta = new Eta()
})
test('reply.view with eta engine and custom templates folder', t => {
t.plan(6)
const fastify = Fastify()
const data = { text: 'text' }
fastify.register(pointOfView, {
engine: {
eta
},
templates: 'templates'
})

from point-of-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.