fp(async function preParsing (fastify, opts) { fastify.addHook('preParsing', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preParsing', (request, reply, next) => { // next() // }) })
fastify.after(() => { fastify.addHook('preHandler', fastify.basicAuth) })
fp(async function preHandler (fastify, opts) { fastify.addHook('preHandler', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preHandler', (request, reply, next) => { // next() // }) })
fp(async function preHandler (fastify, opts) { fastify.addHook('preHandler', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preHandler', (request, reply, next) => { // next() // }) })
fp(async function preParsing (fastify, opts) { fastify.addHook('preParsing', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preParsing', (request, reply, next) => { // next() // }) })
fp(async function onResponse (fastify, opts) { fastify.addHook('onResponse', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('onResponse', (request, reply, next) => { // next() // }) })
fp(async function onSend (fastify, opts) { fastify.addHook('onSend', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('onSend', (request, reply, payload, done) => { // next() // }) })
fp(async function onResponse (fastify, opts) { fastify.addHook('onResponse', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('onResponse', (request, reply, next) => { // next() // }) })
fp(async function preValidation (fastify, opts) { fastify.addHook('preValidation', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preValidation', (request, reply, next) => { // next() // }) })
fp(async function preValidation (fastify, opts) { fastify.addHook('preValidation', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preValidation', (request, reply, next) => { // next() // }) })
fp(async function onSend (fastify, opts) { fastify.addHook('onSend', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('onSend', (request, reply, payload, done) => { // next() // }) })
fp(async function preSerialization (fastify, opts) { fastify.addHook('preSerialization', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preSerialization', (request, reply, next) => { // next() // }) })
fp(async function preSerialization (fastify, opts) { fastify.addHook('preSerialization', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. }) // fastify.addHook('preSerialization', (request, reply, next) => { // next() // }) })
fp(async function onRequest (fastify, opts) { fastify.addHook('onRequest', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. // Notice: in the onRequest and preValidation hooks, request.body will // always be null, because the body parsing happens before the preHandler // hook. }) // fastify.addHook('onRequest', (request, reply, next) => { // next() // }) })
fp(async function onError (fastify, opts) { fastify.addHook('onError', async (request, reply) => { // Notice: the next callback is not available when using async/await // or returning a Promise. If you do invoke a next callback in this // situation unexpected behavior may occur, e.g. duplicate invocation // of handlers. // Notice: in the onRequest and preValidation hooks, request.body will // always be null, because the body parsing happens before the preHandler // hook. }) // fastify.addHook('onError', (request, reply, error, next) => { // next() // }) })