mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
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>
This commit is contained in:
17
apps/sim/app/api/health/route.test.ts
Normal file
17
apps/sim/app/api/health/route.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @vitest-environment node
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { GET } from '@/app/api/health/route'
|
||||
|
||||
describe('GET /api/health', () => {
|
||||
it('returns an ok status payload', async () => {
|
||||
const response = await GET()
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
await expect(response.json()).resolves.toEqual({
|
||||
status: 'ok',
|
||||
timestamp: expect.any(String),
|
||||
})
|
||||
})
|
||||
})
|
||||
12
apps/sim/app/api/health/route.ts
Normal file
12
apps/sim/app/api/health/route.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Health check endpoint for deployment platforms and container probes.
|
||||
*/
|
||||
export async function GET(): Promise<Response> {
|
||||
return Response.json(
|
||||
{
|
||||
status: 'ok',
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user