Response methods
This commit is contained in:
parent
b995f9e2c4
commit
106d656567
|
@ -163,9 +163,22 @@ app.use('<admin dir>', admin)`; // Mounting a sub - app
|
||||||
```Request```
|
```Request```
|
||||||
``Methods``
|
``Methods``
|
||||||
|
|
||||||
`req.param('name')`
|
`req.get('content-type')`
|
||||||
|
|
||||||
|
`req.accepts('html')`
|
||||||
|
|
||||||
|
`req.is('json')`
|
||||||
|
|
||||||
|
`var range = req.range(1000)
|
||||||
|
if (range.type === 'bytes'){
|
||||||
|
range.forEach(function(r){
|
||||||
|
|
||||||
|
})
|
||||||
|
}`
|
||||||
|
|
||||||
``Properties``
|
``Properties``
|
||||||
|
|
||||||
|
`req.param('name')`
|
||||||
|
|
||||||
`app.post('/', function (req, res, next) {
|
`app.post('/', function (req, res, next) {
|
||||||
console.log(req.body)
|
console.log(req.body)
|
||||||
|
@ -181,3 +194,24 @@ res.send('GET')`
|
||||||
|
|
||||||
`console.dir(req.signedCookies.user)`
|
`console.dir(req.signedCookies.user)`
|
||||||
|
|
||||||
|
|
||||||
|
```Response```
|
||||||
|
``Methods``
|
||||||
|
|
||||||
|
`res.redirect('https://google.com')`
|
||||||
|
|
||||||
|
`res.send({message: 'Awesome Stuffs'})`
|
||||||
|
|
||||||
|
`res.json({alert: 'awesomecheatsheets'})`
|
||||||
|
|
||||||
|
`const file = req.params.name;
|
||||||
|
res.sendFile(file, options, function(err){
|
||||||
|
if(err){
|
||||||
|
next(err)
|
||||||
|
}else{
|
||||||
|
console.log('Sent:', file)
|
||||||
|
}
|
||||||
|
})`
|
||||||
|
|
||||||
|
`res.render('index')`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue