import Fastify from 'fastify'; import cors from '@fastify/cors'; import { healthRoutes } from './routes/health.js'; import { categoryRoutes } from './routes/categories.js'; import { recipeRoutes } from './routes/recipes.js'; import { noteRoutes } from './routes/notes.js'; import { shoppingRoutes } from './routes/shopping.js'; import { tagRoutes } from './routes/tags.js'; import { imageRoutes } from './routes/images.js'; import { botRoutes } from './routes/bot.js'; export async function buildApp() { const app = Fastify({ logger: true }); await app.register(cors, { origin: true }); await app.after(); await app.register(healthRoutes); await app.after(); await app.register(categoryRoutes); await app.after(); await app.register(recipeRoutes); await app.after(); await app.register(noteRoutes); await app.after(); await app.register(shoppingRoutes); await app.after(); await app.register(tagRoutes); await app.after(); await app.register(imageRoutes); await app.after(); await app.register(botRoutes); await app.after(); return app; }