Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time. Cannot retrieve contributors at this time
30 lines (25 sloc) 669 Bytes
const assert = require('assert')
const http = require('http')
module.exports = summary
// log the server port and env
// (obj, fn) -> null
function summary (server, write) {
assert.ok(server instanceof http.Server, /expected instance of server/)
write = write || defaultWrite
return function () {
const address = server.address()
const port = address.port
const url = 'http://localhost:' + port
const env = process.env.NODE_ENV || 'undefined'
write({
port: port,
env: env,
pid: process.pid,
url: url
})
}
}
function defaultWrite (obj) {
const msg = JSON.stringify(obj)
process.stdout.write(msg + '\n')
}
You can’t perform that action at this time.