Response Object Flashcards

1
Q

res.status(code)

A

Sets the HTTP status code

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

res.set(name, value)

A

Sets a response header

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

res.cookie(name, value, [options])

A

Sets a cookie that will be stored on the client

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

res.clearCookie(name, [options])

A

Clears a cookie stored on the client

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

res.redirect([status], url)

A

Redirects a browser. Default redirect code is 302

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

res.send(status, body)

A

Sends a response to the client with optional status code

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

res.json(staus, json)

A

Sends JSON to the client with optional status code

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

res.jsonp(status, json)

A

Sends JSONP to the client with optional status code

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

res.type(type)

A

A convenience method to set the Content-Type header. Equivalent to res.set(‘Content-Type’, type) except it maps a file extension to an Internet media type if you provide a type without a slash in it. For instance res.type(‘text’)

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

res.format(object)

A

Allows you to send different content depending on the Accept request header

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

res.attachment([filename])

A

Sets Content-Disposition header to ‘attachment’ causing browser to prompt to download rather than display a file. filename serves as hint to browser

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

res.download(path, [filename], [callback])

A

Sets Content-Disposition header to ‘attachment,’ causing browser to prompt to download rather than display a file.
Allows you to specify a file to download

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

res.sendFile(path, [options], [callback])

A

Read a file specified by path and send its content to the client

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

res.links(links)

A

Sets the Links response header

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

res.locals

A

Object containing the default context for rendering views

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

res.render(view, [locals], callback)

A

Renders a view using the configured templating engine. Default response code 200