hooks-benchmark-async-await.js — fastify Source File
Architecture documentation for hooks-benchmark-async-await.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const fastify = require('../../fastify')({ logger: false })
const opts = {
schema: {
response: {
200: {
type: 'object',
properties: {
hello: {
type: 'string'
}
}
}
}
}
}
function promiseFunction (resolve) {
setImmediate(resolve)
}
async function asyncHook () {
await new Promise(promiseFunction)
}
fastify
.addHook('onRequest', asyncHook)
.addHook('onRequest', asyncHook)
.addHook('preHandler', asyncHook)
.addHook('preHandler', asyncHook)
.addHook('preHandler', asyncHook)
.addHook('onSend', asyncHook)
fastify.get('/', opts, function (request, reply) {
reply.send({ hello: 'world' })
})
fastify.listen({ port: 3000 }, function (err) {
if (err) {
throw err
}
})
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does hooks-benchmark-async-await.js do?
hooks-benchmark-async-await.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in hooks-benchmark-async-await.js?
hooks-benchmark-async-await.js defines 2 function(s): asyncHook, promiseFunction.
Where is hooks-benchmark-async-await.js in the architecture?
hooks-benchmark-async-await.js is located at examples/benchmark/hooks-benchmark-async-await.js (domain: CoreKernel, subdomain: LifecycleManager, directory: examples/benchmark).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free