Skip to content

Commit 984ff56

Browse files
Merge pull request #187 from accompany-io/marconijr/added-healthcheck-endpoint
Add healthcheck endpoint
2 parents 2a02f0c + 7e40ae2 commit 984ff56

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,14 @@ curl -o receipt.html https://rawgit.com/wildbit/postmark-templates/master/templa
295295
curl -o html.pdf -XPOST [email protected] -H"content-type: text/html" http://localhost:9000/api/render?pdf.scale=1
296296
```
297297

298+
### GET /healthcheck
299+
300+
Health check endpoint used for monitoring if the service is still up and running.
301+
302+
```bash
303+
curl -XGET http://localhost:9000/healthcheck
304+
```
305+
298306
## Development
299307

300308
To get this thing running, you have two options: run it in Heroku, or locally.

src/router.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ function createRouter() {
4949
};
5050
router.post('/api/render', validate(postRenderSchema), render.postRender);
5151

52+
router.get('/healthcheck', (req, res) => res.status(200).send('OK'));
53+
5254
return router;
5355
}
5456

test/test-all.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,7 @@ describe('POST /api/render', () => {
210210
})
211211
);
212212
});
213+
214+
describe('GET /healthcheck', () => {
215+
it('should return ok', () => request(app).get('/healthcheck').expect(200));
216+
});

0 commit comments

Comments
 (0)