Express.JS Flashcards
Where can one find documentation for Embedded JavaScript templating?
EJS.co
What line must be used in your app.js file to initialise EJS?
What folder must exist before you can use EJS?
A folder called “views” containing the files that will be rendered by the “res.render(…)” line below.
What type of file will be inside the “views” folder? What type of data can it read?
An “.ejs” file; which reads html data.
Explain the arguments of the “res.render(…)” line, below:
The file will perform calcualtions and then the server will respond (res) to the browser by rendering (render) a file named “list” (which is in a folder called “views” - nb “view engine”). This list.ejs file will have an embedded tag that allows the res.render to send contingent information to the browser using a key-value pair ({ day : day}).
What’s the syntax for .ejs contingent information?
Where EJS stands for whatever name you give a variable in your app.js file.
This is embedding.