Skip to content

Commit

Permalink
Fix healthcheck endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgxvii committed Oct 1, 2024
1 parent 8abb234 commit 1475943
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
5 changes: 0 additions & 5 deletions pages/api/health/alive.ts

This file was deleted.

5 changes: 0 additions & 5 deletions pages/api/health/ready.ts

This file was deleted.

23 changes: 23 additions & 0 deletions pages/health/alive.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ServerResponse } from "http"
import { GetServerSideProps } from "next"
import React from "react"

// Use Node.js's ServerResponse

const Alive = () => {
return <div>Healthy!</div>
}

export const getServerSideProps: GetServerSideProps = async ({
res,
}: {
res: ServerResponse
}) => {
res.statusCode = 200

return {
props: {},
}
}

export default Alive
21 changes: 21 additions & 0 deletions pages/health/ready.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ServerResponse } from "http"
import { GetServerSideProps } from "next"
import React from "react"

const Ready = () => {
return <div>Ready!</div>
}

export const getServerSideProps: GetServerSideProps = async ({
res,
}: {
res: ServerResponse
}) => {
res.statusCode = 200

return {
props: {},
}
}

export default Ready

0 comments on commit 1475943

Please sign in to comment.