Pug template express2/20/2023 ![]() ![]() in the link handler index.js added the correct paths to the templates after updating the folder structure and pug files in the views folder. ![]() Path.join(_dirname, '/views/public/fragments')]) Īpp.use(express.urlencoded( Path.join(_dirname, '/views/public/templates'), This is the structure of my folders and, the contacts.pugtemplate is not visible for render()Īpp.js const createError = require('http-errors') Ĭonst cookieParser = require('cookie-parser') Ĭonst indexRouter = require('./routes/index') Ĭonst usersRouter = require('./routes/users') Īpp.set('views', [path.join(_dirname, '/views'), ![]() I make the structure of folders and views then the internal templates are not visible for rendering. Nowuse app.set () method as shown below in index.js to set Pug templating engine. After successful installation of Pug engine, create a directory named views. When all the templates are in the views folder then we successfully render them. To install Pug templating engine, execute the following command: npm install -save pug Remember to use save in command to update package.json. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |