Skip to content

Commit

Permalink
Do not use morgan internally
Browse files Browse the repository at this point in the history
Summary: `morgan` produces non-json output, which affects `js1 run` when ran with the `--json` flag.

Reviewed By: Kureev

Differential Revision: D8724830

fbshipit-source-id: 11377f6ef39341c658a7f905383398423a721630
  • Loading branch information
Miguel Jimenez Esun authored and facebook-github-bot committed Jul 3, 2018
1 parent ba56725 commit bbc8bb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions local-cli/server/middleware/MiddlewareManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
const compression = require('compression');
const connect = require('connect');
const errorhandler = require('errorhandler');
const morgan = require('morgan');
const path = require('path');
const serveStatic = require('serve-static');
const WebSocketServer = require('ws').Server;
Expand All @@ -33,7 +32,8 @@ type WebSocketProxy = {
server: WebSocketServer,
isChromeConnected: () => boolean,
};
type Connect = any;

type Connect = $Call<connect>;

module.exports = class MiddlewareManager {
app: Connect;
Expand All @@ -52,7 +52,6 @@ module.exports = class MiddlewareManager {
.use(statusPageMiddleware)
.use(systraceProfileMiddleware)
.use(indexPageMiddleware)
.use(morgan('combined'))
.use(errorhandler());
}

Expand Down
3 changes: 3 additions & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Metro = require('metro');

const {Terminal} = require('metro-core');

const morgan = require('morgan');
const path = require('path');
const MiddlewareManager = require('./middleware/MiddlewareManager');

Expand Down Expand Up @@ -47,6 +48,8 @@ async function runServer(args: Args, config: ConfigT) {
const reporter = new ReporterImpl(terminal);
const middlewareManager = new MiddlewareManager(args);

middlewareManager.getConnectInstance().use(morgan('combined'));

args.watchFolders.forEach(middlewareManager.serveStatic);

const serverInstance = await Metro.runServer({
Expand Down

0 comments on commit bbc8bb1

Please sign in to comment.