import '@abraham/reflection' import {join} from 'path' import AutoLoad, {AutoloadPluginOptions} from 'fastify-autoload' import {FastifyPluginAsync} from 'fastify' import {container} from 'tsyringe'; export type AppOptions = { // Place your custom options for app below here. } & Partial; const app: FastifyPluginAsync = async ( fastify, opts, ): Promise => { // Place here your custom code! const modules = await Promise.all([ import('./global'), import('./modules/ringtone'), ]) modules.forEach(m => m.default(container)) // 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;