Skip to content

Commit d84cba6

Browse files
PlaneInABottletest
andauthored
chore(self-hosting): add health check endpoint (#3562)
Add a simple API health route for deployment platforms and container probes, with focused route coverage. Co-authored-by: test <test@example.com>
1 parent d90f828 commit d84cba6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @vitest-environment node
3+
*/
4+
import { describe, expect, it } from 'vitest'
5+
import { GET } from '@/app/api/health/route'
6+
7+
describe('GET /api/health', () => {
8+
it('returns an ok status payload', async () => {
9+
const response = await GET()
10+
11+
expect(response.status).toBe(200)
12+
await expect(response.json()).resolves.toEqual({
13+
status: 'ok',
14+
timestamp: expect.any(String),
15+
})
16+
})
17+
})

apps/sim/app/api/health/route.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Health check endpoint for deployment platforms and container probes.
3+
*/
4+
export async function GET(): Promise<Response> {
5+
return Response.json(
6+
{
7+
status: 'ok',
8+
timestamp: new Date().toISOString(),
9+
},
10+
{ status: 200 }
11+
)
12+
}

0 commit comments

Comments
 (0)