|
123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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<AutoloadPluginOptions>;
-
- const app: FastifyPluginAsync<AppOptions> = async (
- fastify,
- opts,
- ): Promise<void> => {
- // 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;
|