View on GitHub

reads

https://yazansneneh.github.io/reads/

EJS

Using EJS

  1. inside terminal npm install ejs.
  2. then navitage to project folder and set view engine to use ejs.
    • app.set('view engine', 'ejs') // tell it i am using ejs
    • app.set('views', __dirname+ 'views') // tell app that views inside views folder in the first parameter, and it's living inside the path inside the second parameter.
  3. create a file in views folder with extention .ejs : index.ejs.
  4. write html inside it.
  5. create a route and send that file on matched url, the reason it will work because i configured my application to use it earlier.
a.get('/home',(req,res)=>{
    res.render('index')
})

INJECT VARIABLES.

control flow:

Layout.

Partials.