Files
backbone/src/api/api.ts
Morten Olsen 06240ed656
Some checks failed
Build and release / Build (push) Successful in 14s
Build and release / update-release-draft (push) Successful in 2s
Build and release / Release (push) Failing after 7s
feat: add build
2025-10-16 23:06:58 +02:00

37 lines
859 B
TypeScript

import { type FastifyPluginAsync } from 'fastify';
import { z } from 'zod';
import { manageEndpoints } from './endpoints/endpoints.manage.ts';
import { authPlugin } from './plugins/plugins.auth.ts';
import { messageEndpoints } from './endpoints/endpoints.message.ts';
const api: FastifyPluginAsync = async (fastify) => {
fastify.route({
method: 'get',
url: '/health',
schema: {
operationId: 'health.get',
summary: 'Get health status',
tags: ['system'],
response: {
200: z.object({
status: z.literal('ok'),
}),
},
},
handler: () => {
return { status: 'ok' };
},
});
await authPlugin(fastify, {});
await fastify.register(manageEndpoints, {
prefix: '/manage',
});
await fastify.register(messageEndpoints, {
prefix: '/message',
});
};
export { api };