Use better API to return JSON from endpoint

Summary: ^

Reviewed By: antonk52

Differential Revision: D49537411

fbshipit-source-id: d5cabcf1c22d57fc47e1e80cbf0edb70effee308
This commit is contained in:
Lorenzo Blasa
2023-09-22 08:17:48 -07:00
committed by Facebook GitHub Bot
parent bdf5065f10
commit 1d29e06b76

View File

@@ -136,18 +136,15 @@ async function startHTTPServer(
});
app.get('/ready', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({isReady}));
res.json({isReady});
});
app.get('/info', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(environmentInfo));
res.json(environmentInfo);
});
app.get('/shutdown', (_req, res) => {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({success: true}));
res.json({success: true});
// Just exit the process, this will trigger the shutdown hooks.
process.exit(0);