feat: add initial API

This commit is contained in:
Morten Olsen
2025-10-16 20:54:31 +02:00
parent 5cf0a3612a
commit 11828da073
17 changed files with 647 additions and 89 deletions

View File

@@ -1,8 +1,34 @@
import { type FastifyPluginAsync } from 'fastify';
import { manageEndpoints } from './endpoints/endpoints.manage.ts';
import { authPlugin } from './plugins/plugins.auth.ts';
import { messageEndpoints } from './endpoints/endpoints.message.ts';
import { z } from 'zod';
const api: FastifyPluginAsync = async (fastify) => {
fastify.get('/healthz', () => {
return { status: 'ok' };
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',
});
};