fastify generate myproject JSON Schema 和 hooks 处理请求示例: import Fastify from "fastify"; const fastify = Fastify({ logger: true, }); fastify.route({ method: "GET", url: "/", schema: { // request needs to have a querystring with a `name` parameter querystring: { type: "object",...
connectionString:'postgresql://名字:密码@数据库服务器名:端口号/数据库名'}) }// Wrapping a plugin function with fastify-plugin exposes the decorators// and hooks, declared inside the plugin to the parent scope.module.exports =fastifyPlugin(dbConnector) 注册插件 打开app.js 注册我们写的插件 fasti...
有啥稀奇。但是就是在这个一般人忽略的地方 fastify 却做出了花,做到了『2x faster than JSON.stringif...
Hooks Decorators Validation and Serialization Fluent Schema Lifecycle Reply Request Errors Content Type Parser Plugins Testing Benchmarking How to write a good plugin Plugins Guide HTTP2 Long Term Support TypeScript and types support Serverless
Hooks and middleware Every registered middleware will be run during theonRequesthook phase, so the registration order is important. Take a look at theLifecycledocumentation page to understand better how every request is executed. constfastify=require('fastify')()fastify.register(require('@fastify/expr...
fastify/types/hooks.d.ts Version: 50.4 kBTypeScriptView Raw 1 import { Readable } from 'stream' 2 import { FastifyInstance } from './instance' 3 import { RouteOptions, RouteGenericInterface } from './route' 4 import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, Raw...
Hooks Decorators Validation and Serialization Fluent Schema Lifecycle Reply Request Errors Content Type Parser Plugins Testing Benchmarking How to write a good plugin Plugins Guide HTTP2 Long Term Support TypeScript and types support Serverless
● Extensible: 通过 hooks, plugins and decorators 来实现扩展性. ● Schema based: 不强制使用 JSON Schema 验证你的路由配置,及时配置了,编译也是很快的. ● Logging: 使用Pino来记录日志,并把损耗降低。 ● Developer friendly: 对开发者友好,而且对性能、安全性也有考虑、设计. ...
Hooks and middleware Every registered middleware will be run during theonRequesthook phase, so the registration order is important. Take a look at theLifecycledocumentation page to understand better how every request is executed. constfastify=require('fastify')()fastify.register(require('@fastify/expr...
Hooks Decorators Validation and Serialization Fluent Schema Lifecycle Reply Request Errors Content Type Parser Plugins Testing Benchmarking How to write a good plugin Plugins Guide HTTP2 Long Term Support TypeScript and types support Serverless