Request
The first parameter of the handler function is Request
.Request is a core Fastify object containing the following fields:
query
- the parsed querystringbody
- the bodyparams
- the params matching the URLheaders
- the headersraw
- the incoming HTTP request from Node core (you can use the aliasreq
)id
- the request idlog
- the logger instance of the incoming request
fastify.post('/:params', options, function (request, reply) {
console.log(request.body)
console.log(request.query)
console.log(request.params)
console.log(request.headers)
console.log(request.raw)
console.log(request.id)
request.log.info('some info')
})
当前内容版权归 Fastify 官网 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Fastify 官网 .