Let's Discuss about Pug?
Rahul Vishwakarma
1 min read
Pug is engine template for express & is used to render the dynamic files
Pug is come with built in function in node js and if we got any problem in rendering then you have to download pug (npm i pug)
Tell express which template engine we are gonna use
//Setting Pug(template engine)
app.set('view engine','pug');
// app.set('views',path.join(__dirname,'views'));
app.set('views',`${__dirname}/views`); // (1)
// router for pug (template engine )
app.use('/',viewRouter);
res.status(200).render('overview'});
// It will look for 'overview' file into the views (1) folder as we
// specified it .Take that template & render it & then send to the
// browser
Simply, Pug is a simple whitespace sensitive syntax for writing html
Now we will discuss - First step with Pug (Link)
1
Subscribe to my newsletter
Read articles from Rahul Vishwakarma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Rahul Vishwakarma
Rahul Vishwakarma
I am Developer learning new skills and tools And currently pursuing B.Tech in CSE (Graduating Year 2026)