W6. NodeJS Express Flashcards

1
Q

What is the purpose of Express?

A

Express is a framework for Node.js
Makes it easier to make RESTful APIs
Provides structure for server-side code to mirror structure in URL code we are serving

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

What are 3 benefits of using Express?

A
  1. ) Defines a routing table used to perform different actions based on HTTP Method and URL
  2. ) Permits dynamic rendering of HTML pages based on passing arguments to templates
  3. ) Makes server code simpler by imposing structure

(also ability to mix static HTML with web pages

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

What is the purpose of Routes?

A

Allow you to tidy-up directory structure and scale up a web server to industrial-scale structure

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

What are templates?

A
  • static template files
  • describe some structure expanded into HTML
  • HTML expressed at higher-level using template language
  • At runtime, a template engine converts all variables in template into actual values and sends HTML to the client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What template engine does Express use by default?

A

Pug (formerly Jade)

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

Advantages and disadvantages of Pug

A

Advantages:
- templating allows boilerplate pages to be created that can be specialised
- Good readability - write paragraphs
- indentation (white space) instead of tags for structure
Disadvantages:
- white space indentation is error prone
- cannot use a mixture of template language and HTML, in Pug - only Pug!

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