diff --git a/packager/packager.js b/packager/packager.js index 9ca6c05ba6..0c4a21c2a7 100644 --- a/packager/packager.js +++ b/packager/packager.js @@ -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(); diff --git a/packager/statusPageMiddleware.js b/packager/statusPageMiddleware.js new file mode 100644 index 0000000000..fb793468ff --- /dev/null +++ b/packager/statusPageMiddleware.js @@ -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(); + } +};