Unify oss and internal version of status page middleware

Reviewed By: @vjeux

Differential Revision: D2519415

fb-gh-sync-id: 2cf27c88b29c18a7a1f3aa1611f0d7f510a8fa24
This commit is contained in:
Martín Bigio 2015-10-08 14:15:15 -07:00 committed by facebook-github-bot-4
parent e742683859
commit b8a8df1052
2 changed files with 22 additions and 11 deletions

View File

@ -23,6 +23,7 @@ const getDevToolsMiddleware = require('./getDevToolsMiddleware');
const openStackFrameInEditorMiddleware = require('./openStackFrameInEditorMiddleware');
const parseCommandLine = require('./parseCommandLine.js');
const ReactPackager = require('./react-packager');
const statusPageMiddleware = require('./statusPageMiddleware.js');
const webSocketProxy = require('./webSocketProxy.js');
var options = parseCommandLine([{
@ -167,17 +168,6 @@ function loadRawBody(req, res, next) {
});
}
// A status page so the React/project.pbxproj build script
// can verify that packager is running on 8081 and not
// another program / service.
function statusPageMiddleware(req, res, next) {
if (req.url === '/status') {
res.end('packager-status:running');
} else {
next();
}
}
function systraceProfileMiddleware(req, res, next) {
if (req.url !== '/systrace') {
next();

21
statusPageMiddleware.js Normal file
View File

@ -0,0 +1,21 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Status page so that anyone who needs to can verify that the packager is
* running on 8081 and not another program / service.
*/
module.exports = function(req, res, next) {
if (req.url === '/status') {
res.end('packager-status:running');
} else {
next();
}
};