mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-30 19:55:26 +08:00
36 lines
876 B
TypeScript
36 lines
876 B
TypeScript
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 }
|