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) => {
|
app.get('/ready', (_req, res) => {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.json({isReady});
|
||||||
res.end(JSON.stringify({isReady}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/info', (_req, res) => {
|
app.get('/info', (_req, res) => {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.json(environmentInfo);
|
||||||
res.end(JSON.stringify(environmentInfo));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/shutdown', (_req, res) => {
|
app.get('/shutdown', (_req, res) => {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.json({success: true});
|
||||||
res.end(JSON.stringify({success: true}));
|
|
||||||
|
|
||||||
// Just exit the process, this will trigger the shutdown hooks.
|
// Just exit the process, this will trigger the shutdown hooks.
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user