Request objects
is now called
req.pathParams
req.parameters
is now calledreq.queryParams
req.params()
is now calledreq.param()
req.requestType
is now calledreq.method
req.compatibility
is now calledreq.arangoVersion
req.user
is now calledreq.arangoUser
Some attributes have been removed or changed:
req.requestBody
has been removed entirely (see below)is now a string rather than an array
Additionally the req.server
and req.client
attributes are no longer available. The information is now exposed in a way that can (optionally) transparently handle proxy forwarding headers:
req.hostname
defaults toreq.server.address
req.port
defaults toreq.server.port
req.remoteAddress
defaults toclient.address
req.remotePort
defaults toclient.port
Old:
New:
const sid = req.cookie('sid', {
secret: 'keyboardcat',
});
The req.body
is no longer a method and no longer automatically parses JSON request bodies unless a request body was defined. The req.rawBody
now corresponds to the req.rawBodyBuffer
of ArangoDB 2.x and is also no longer a method.
Old:
New:
router.post('/', function (req, res) {
const data = req.body;
// ...
})
.body(['json']);
Or simply:
Multipart requests
The req.requestParts
method has been removed entirely. If you need to accept multipart request bodies, you can simply define the request body using a multipart MIME type like multipart/form-data
:
ctrl.post('/', function (req, res) {
const parts = req.requestParts();
New: