Use better API to return JSON from endpoint
Summary: ^ Reviewed By: antonk52 Differential Revision: D49537411 fbshipit-source-id: d5cabcf1c22d57fc47e1e80cbf0edb70effee308
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bdf5065f10
commit
1d29e06b76
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user