Skip to content

Commit dabe79f

Browse files
chapajperelli
authored andcommitted
Add a /health endpoint and use it with docker's HEALTHCHECK
1 parent b5256a0 commit dabe79f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ RUN \
2323
WORKDIR /app
2424
EXPOSE 3000
2525
CMD [ "npm", "run", "installandstartdev" ]
26+
27+
HEALTHCHECK CMD curl -f http://localhost:3000/health || exit 1

src/server.js

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ app.use((req, res, next) => {
2222
next();
2323
});
2424

25+
app.get("/health", (req, res) => res.sendStatus(200));
26+
2527
const handler = (res, params) => {
2628
osmsm(params)
2729
.then(data => res.end(data))

0 commit comments

Comments
 (0)