import { FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify'; import { App } from '../entities/app/_App'; const appRoutes: FastifyPluginAsync = async (app) => { app.get('/by-name/:name', async (request: FastifyRequest<{ Params: { name: string } }>, reply: FastifyReply) => { const { name } = request.params; const appEntity = await request.em.findOne(App, { name }); if (!appEntity) return reply.status(404).send({ error: 'App not found' }); return reply.send({ id: appEntity.id, name: appEntity.name }); }); }; export default appRoutes;