healthcheck 방어코드
This commit is contained in:
@@ -38,6 +38,9 @@ services:
|
||||
restart: always
|
||||
|
||||
linkforty-prod:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: linkforty-custom:latest
|
||||
container_name: linkforty-core-prod
|
||||
restart: always
|
||||
@@ -69,6 +72,9 @@ services:
|
||||
restart: always
|
||||
|
||||
linkforty-sandbox:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: linkforty-custom:latest
|
||||
container_name: linkforty-core-sandbox
|
||||
restart: always
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import Fastify from 'fastify';
|
||||
import { wellKnownRoutes } from './well-known.js';
|
||||
|
||||
describe('health endpoints', () => {
|
||||
it('returns 200 for GET /health', async () => {
|
||||
const app = Fastify();
|
||||
await app.register(wellKnownRoutes);
|
||||
await app.ready();
|
||||
|
||||
const res = await app.inject({ method: 'GET', url: '/health' });
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.json()).toMatchObject({ status: 'ok' });
|
||||
|
||||
await app.close();
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,16 @@
|
||||
import { FastifyInstance } from 'fastify';
|
||||
|
||||
export async function wellKnownRoutes(fastify: FastifyInstance) {
|
||||
/**
|
||||
* Basic health endpoint for container orchestration and reverse proxies.
|
||||
*/
|
||||
fastify.get('/health', async (request, reply) => {
|
||||
return reply.status(200).send({
|
||||
status: 'ok',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Apple App Site Association (AASA)
|
||||
* Used by iOS to verify Universal Links
|
||||
|
||||
Reference in New Issue
Block a user