Introduction-to-routing Flashcards

1
Q

How do you route using the app object?

A

app.httpRequest(‘route’, (req, res) => {}) e.g. app.get(‘/home’, (req, res) => {})

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

How do you add a status code to your response?

A

res.status(code).send(‘response’);

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

How do you respond with JSON?

A

res.json(obj)

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