Search code examples
node.jsexpresstemplate-engine

How to change template engine of node.js project?


I have this node.js project, it uses jade template. But I need to use simple html pages. Guideline needed for safe transformation.

I need to use complete .html pages like index.html, login.html. Without any template engine to show at routes like localhost:3000 and localhost:3000/login.html. Which should work with full functionality.


Solution

  • You can change it in config/express.js:

    app.set('view engine', 'jade')
    

    For example, if you want to use Handlebars, then remove "jade": "latest", in packages.json and add "handlebars": "latest". Then run npm install and edit config/express.js:

     app.set('view engine', 'handlebars')