Skip to content

Commit

Permalink
modernize expressjs usage, which fixes express-middleware-server-timing
Browse files Browse the repository at this point in the history
  • Loading branch information
cvazac authored and nicjansma committed Apr 4, 2018
1 parent e85fdf4 commit 69ae882
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var path = require("path");
var fs = require("fs");
var readline = require("readline");
var express = require("express");
var http = require("http");
var compress = require("compression");

//
Expand Down Expand Up @@ -35,13 +34,6 @@ if (!fs.existsSync(wwwRoot)) {
}

var app = express();
var server = http.createServer(app);

// listen
var port = process.env.PORT || env.port;
server.listen(port, function() {
console.log("Server starting on port " + port + " for " + wwwRoot);
});

// ensure content is compressed
app.use(compress());
Expand Down Expand Up @@ -126,4 +118,11 @@ app.get("/*", function(req, res, next) {
/*eslint dot-notation:0*/
app.use(express.static(wwwRoot));

// this needs to be before `app.listen(...)`
require("express-middleware-server-timing")(app);

// listen
var port = process.env.PORT || env.port;
app.listen(port, function() {
console.log(`Server starting on port ${port} for ${wwwRoot}`);
});

0 comments on commit 69ae882

Please sign in to comment.