Skip to content

Commit e67a957

Browse files
Add a healthcheck endpoint to the devserver (#9748)
* Add a healthcheck endpoint to the devserver This assists in implementing a few self-healing mechanisms. * Prefix healtcheck endpoint with __parcel --------- Co-authored-by: pyamada (Remote Dev Environment) <[email protected]>
1 parent 900944c commit e67a957

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/reporters/dev-server/src/Server.js

+11
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,17 @@ export default class Server {
495495
setHeaders(res);
496496
next();
497497
});
498+
499+
app.use((req, res, next) => {
500+
if (req.url === '/__parcel_healthcheck') {
501+
res.statusCode = 200;
502+
res.write(`${Date.now()}`);
503+
res.end();
504+
} else {
505+
next();
506+
}
507+
});
508+
498509
await this.applyProxyTable(app);
499510
app.use(finalHandler);
500511

0 commit comments

Comments
 (0)