Buckets:
ktongue/docker_container / .cache /opencode /node_modules /fastify /examples /benchmark /hooks-benchmark-async-await.js
| 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 | |
| } | |
| }) | |
Xet Storage Details
- Size:
- 789 Bytes
- Xet hash:
- 9b52f42567de71c7bb3f7a208a5fd5f0d8e34ce03fab86894a4518b5ee39538e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.