@finwo/router-fastify
v0.5.0
Published
TypeScript controller decorators for fastify
Downloads
12
Readme
@finwo/router-fastify
@finwo/router-fastify is a fastify adapter for the @finwo/router router decorators.
Installation
To start using @finwo/router-fastify, install the required packages via NPM:
npm install --save @finwo/router @finwo/router-fastify
Usage
To use this adapter to load your controllers into fastify, add the following to the initialization of your fastify instance.
// index.ts
import fastify = require('fastify')();
import { plugin } from '@finwo/router-fastify';
// Build a list of controllers we'll start our application with
// Classes registered as controller will NOT be included by default
import { SomeController } from './some-controller';
const controllers: any[] = [
SomeController,
];
// Register your controllers' routes
fastify.register(plugin, controllers);
For further usage, check out the @finwo/router readme.
Middleware
This adapter does support middleware, by chaining the middleware before the actual route handler.