Express.JS Flashcards

1
Q

Where can one find documentation for Embedded JavaScript templating?

A

EJS.co

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What line must be used in your app.js file to initialise EJS?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What folder must exist before you can use EJS?

A

A folder called “views” containing the files that will be rendered by the “res.render(…)” line below.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What type of file will be inside the “views” folder? What type of data can it read?

A

An “.ejs” file; which reads html data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the arguments of the “res.render(…)” line, below:

A

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}).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s the syntax for .ejs contingent information?

A

Where EJS stands for whatever name you give a variable in your app.js file.

This is embedding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly