Skip to content

Commit 78be97a

Browse files
committed
improve send method documentation
1 parent 13d4ea1 commit 78be97a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,33 @@ service.post('/star/:username', async (req, res) => {
114114
})
115115
```
116116

117-
### Sending custom headers:
117+
### Sending custom headers
118118
```js
119119
res.send('Hello World', 200, {
120120
'x-response-time': 100
121121
})
122122
```
123+
124+
### The "res.send" method
125+
Same as in express, for `restana` we have implemented a handy `send` method that extends
126+
every `res` object.
127+
128+
Supported datatypes are:
129+
- null
130+
- undefined
131+
- String
132+
- Buffer
133+
- Object
134+
- Stream
135+
- Promise
136+
137+
Example usage:
138+
```js
139+
service.get('/promise', (req, res) => {
140+
res.send(Promise.resolve('I am a Promise object!'))
141+
})
142+
```
143+
123144
### Acknowledge from low-level `end` operation
124145
```js
125146
res.send('Hello World', 200, {}, (err) => {

0 commit comments

Comments
 (0)