Skip to content

Commit

Permalink
feat(morgan): patching env to allow morgan to run
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jan 8, 2016
1 parent 170225a commit 4dd42b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/patch-sw-environment-for-express.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ if (typeof global.XMLHttpRequest === 'undefined') {
global.XMLHttpRequest = require('./XMLHttpRequest-mock')
}

// high resolution timestamps
/* global performance */
process.hrtime = performance.now.bind(performance)

process.stdout = {
write: function fakeWrite (str) {
console.log(str)
}
}

// http structures used inside Express
var http = require('http')
if (!http.IncomingMessage) {
Expand Down
5 changes: 4 additions & 1 deletion src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ function expressService (app) {
headers: {
'content-type': event.request.headers.get('content-type')
},
unpipe: function () {}
unpipe: function () {},
connection: {
remoteAddress: '::1'
}
}
// console.log(req)
var res = {
Expand Down

0 comments on commit 4dd42b9

Please sign in to comment.