Socket
Socket
Sign inDemoInstall

@scaleleap/fastify

Package Overview
Dependencies
10
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @scaleleap/fastify

Fastify helpers


Version published
Weekly downloads
1
Maintainers
2
Created
Weekly downloads
 

Readme

Source

📦 @scaleleap/fastify

Fastify helpers.


Usage

import { createServer, createRoute, createSchema, typebox } from '../src'
import { createLogger } from '@scaleleap/logger'

const { server, listen } = createServer({
  logger: createLogger(),
})

server.route(
  createRoute(
    // same params as server.route(...)
    {
      method: 'GET',
      url: '/',
      handler: async (req, res) => ({ page: req.query.page }),
    },

    // creates a JSON Schema validator for the request, fully type inferred
    createSchema({
      querystring: typebox.Type.Object({
        page: typebox.Type.Number({ minimum: 1, maximum: 99 }),
      }),
    }),
  ),
)

// has sane defaults for port and address
listen()

You can also find the runnable example in test/server.ts

Download & Installation

$ npm i -s @scaleleap/fastify

Contributing

This repository uses Conventional Commit style commit messages.

Authors or Acknowledgments

  • Roman Filippov (Scale Leap)

License

This project is licensed under the MIT License.

Badges

GitHub Workflow Status NPM License Coveralls Semantic Release

FAQs

Last updated on 05 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc