Skip to content

Commit

Permalink
Expose HTTP shutdown API
Browse files Browse the repository at this point in the history
Summary: Expose the shutdown API via the HTTP server.

Reviewed By: ivanmisuno

Differential Revision: D49496840

fbshipit-source-id: df2045edc89e9feabe74b4b513f973d137323d0f
  • Loading branch information
lblasa authored and facebook-github-bot committed Sep 21, 2023
1 parent 1db90f9 commit 6df2782
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions desktop/flipper-server-core/src/server/startServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ async function startHTTPServer(config: Config): Promise<{
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) => {
res.end('flipper-ok');
});
Expand Down

0 comments on commit 6df2782

Please sign in to comment.