Skip to content

Commit a1d2b37

Browse files
authored
Merge pull request #6 from badsyntax/bugfix/healthcheck
Fix healthcheck
2 parents dd2ab3b + da2e63b commit a1d2b37

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ FROM base AS runner
3232

3333
RUN apk add curl=7.67.0-r3 --no-cache
3434

35-
HEALTHCHECK CMD curl --fail http://localhost:5000/ || exit 1
35+
HEALTHCHECK CMD curl --fail http://localhost:5000/healthcheck || exit 1
3636

3737
WORKDIR /app
3838

src/app.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ if (!GITHUB_TOKEN) {
1010
throw new Error('Env not set correctly');
1111
}
1212

13-
import { indexRoute } from './routes/api/index';
13+
import { apiRoute } from './routes/api/index';
14+
import { healthCheckRoute } from './routes/healthcheck';
1415

1516
const app = express();
1617

1718
app.use(logger('dev') as RequestHandler);
1819
app.use(express.json() as RequestHandler);
1920
app.use(express.urlencoded({ extended: false }) as RequestHandler);
2021

21-
app.use('/api', indexRoute);
22+
app.use('/api', apiRoute);
23+
app.use('/healthcheck', healthCheckRoute);
2224

2325
export default app;

src/routes/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Router, Request, Response } from 'express';
22
import { ResponseBody, RequestBody, QueryParams } from './types';
3-
export const indexRoute = Router();
3+
export const apiRoute = Router();
44

5-
indexRoute.post(
5+
apiRoute.post(
66
'/',
77
async (
88
req: Request<null, ResponseBody, RequestBody, QueryParams>,

src/routes/healthcheck/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Router, Request, Response } from 'express';
2+
export const healthCheckRoute = Router();
3+
4+
healthCheckRoute.get('/', async (req: Request, res: Response) => {
5+
res.status(200).send('Healthy');
6+
});

0 commit comments

Comments
 (0)