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) => {})
2
Q
How do you add a status code to your response?
A
res.status(code).send(‘response’);
3
Q
How do you respond with JSON?
A
res.json(obj)