在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Fastify开源软件地址:https://gitee.com/mirrors/Fastify开源软件介绍:An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users.How can you efficiently handle the resources of your server, knowing that you are serving the highest number of requests as possible, without sacrificing security validations and handy development?
Enter Fastify. Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town. This branch refers to the upcoming Fastify v4 release. Check out the v3.x branch for v3. Quick startCreate a folder and make it your current working directory: mkdir my-appcd my-app Generate a fastify project with npm init fastify Install dependencies: npm install To start the app in dev mode: npm run dev For production mode: npm start Under the hood InstallIf installing in an existing project, then Fastify can be installed into the project as a dependency: Install with npm: npm i fastify@next --save Install with yarn: yarn add fastify@next Example// Require the framework and instantiate it// ESMimport Fastify from 'fastify'const fastify = Fastify({ logger: true})// CommonJsconst fastify = require('fastify')({ logger: true})// Declare a routefastify.get('/', (request, reply) => { reply.send({ hello: 'world' })})// Run the server!fastify.listen({ port: 3000 }, (err, address) => { if (err) throw err // Server is now listening on ${address}}) with async-await: // ESMimport Fastify from 'fastify'const fastify = Fastify({ logger: true})// CommonJsconst fastify = require('fastify')({ logger: true})fastify.get('/', async (request, reply) => { reply.type('application/json').code(200) return { hello: 'world' }})fastify.listen({ port: 3000 }, (err, address) => { if (err) throw err // Server is now listening on ${address}}) Do you want to know more? Head to the Fastify v1.x and v2.xCode for Fastify's v1.x is in
Core features
BenchmarksMachine: EX41S-SSD, Intel Core i7, 4Ghz, 64GB RAM, 4C/8T, SSD. Method::
Benchmarks taken using https://github.com/fastify/benchmarks. This is asynthetic, "hello world" benchmark that aims to evaluate the frameworkoverhead. The overhead that each framework has on your applicationdepends on your application, you should always benchmark if performancematters to you. Documentation
中文文档地址 Ecosystem
SupportPlease visit Fastify help to view priorsupport issues and to ask new support questions. TeamFastify is the result of the work of a great community.Team members are listed in alphabetical order. Lead Maintainers:
Fastify Core team
Fastify Plugins team
Great ContributorsGreat contributors on a specific area in the Fastify ecosystem will be invited to join this group by Lead Maintainers.
Past Collaborators
Hosted byWe are a Growth Project in the OpenJS Foundation. AcknowledgementsThis project is kindly sponsored by: Past Sponsors: LicenseLicensed under MIT. For your convenience, here is a list of all the licenses of our production dependencies:
|
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论