UNPKG

fastify-cli

Version:

Run a fastify route with one command!

36 lines (28 loc) 875 B
import { join } from 'path'; import AutoLoad, {AutoloadPluginOptions} from 'fastify-autoload'; import { FastifyPluginAsync } from 'fastify'; export type AppOptions = { // Place your custom options for app below here. } & Partial<AutoloadPluginOptions>; const app: FastifyPluginAsync<AppOptions> = async ( fastify, opts ): Promise<void> => { // Place here your custom code! // Do not touch the following lines // This loads all plugins defined in plugins // those should be support plugins that are reused // through your application void fastify.register(AutoLoad, { dir: join(__dirname, 'plugins'), options: opts }) // This loads all plugins defined in routes // define your routes in one of these void fastify.register(AutoLoad, { dir: join(__dirname, 'routes'), options: opts }) }; export default app; export { app }