Skip to main content
Glama
hooks-benchmark-async-await.js789 B
'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 } })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/krtw00/search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server