UNPKG

create-fastify-app

Version:
30 lines (24 loc) 758 B
'use strict' const path = require('path') const AutoLoad = require('fastify-autoload') module.exports = function (fastify, opts, next) { // This loads all plugins defined in plugins // those should be support plugins that are reused // through your application fastify.register(AutoLoad, { dir: path.join(__dirname, 'plugins'), options: Object.assign({}, opts) }) // This loads all plugins defined in services // define your routes in one of these fastify.register(AutoLoad, { dir: path.join(__dirname, 'services'), options: Object.assign({}, opts) }) // This loads all hooks defined in hooks fastify.register(AutoLoad, { dir: path.join(__dirname, 'hooks'), options: Object.assign({}, opts) }) next() }