Expose HTTP shutdown API

Summary: Expose the shutdown API via the HTTP server.

Reviewed By: ivanmisuno

Differential Revision: D49496840

fbshipit-source-id: df2045edc89e9feabe74b4b513f973d137323d0f
This commit is contained in:
Lorenzo Blasa
2023-09-21 06:09:19 -07:00
committed by Facebook GitHub Bot
parent 1db90f9187
commit 6df27824b7

View File

@@ -133,6 +133,14 @@ async function startHTTPServer(config: Config): Promise<{
res.end(JSON.stringify({isReady})); res.end(JSON.stringify({isReady}));
}); });
app.get('/shutdown', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({success: true}));
// Just exit the process, this will trigger the shutdown hooks.
process.exit(0);
});
app.get('/health', (_req, res) => { app.get('/health', (_req, res) => {
res.end('flipper-ok'); res.end('flipper-ok');
}); });