Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
feat(ssrServer): added readiness check route (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
10xLaCroixDrinker authored Jul 28, 2020
1 parent f930c09 commit a342e71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions __tests__/server/ssrServer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ describe('ssrServer', () => {
});
});

it('should return a 200 response for the readiness check', (done) => {
request(loadServer())
.get('/_/status')
.end((error, res) => {
expect(res.status).toEqual(200);
expect(res.text).toEqual('OK');
expect(res.type).toEqual('text/plain');
done();
});
});

it('should use rendering middleware for HTML requests', (done) => {
request(loadServer())
.get('/some.html')
Expand Down
1 change: 1 addition & 0 deletions src/server/ssrServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function createApp({ enablePostToModuleRoutes = false } = {}) {
app.use(forwardedHeaderParser);

app.use('/_/static', express.static(path.join(__dirname, '../../build'), { maxage: '182d' }));
app.get('/_/status', (req, res) => res.sendStatus(200));
app.get('/_/pwa/service-worker.js', serviceWorkerMiddleware());
app.get('*', addCacheHeaders);
app.get('/_/pwa/manifest.webmanifest', webManifestMiddleware());
Expand Down

0 comments on commit a342e71

Please sign in to comment.