This commit is contained in:
Lloyd Brookes
2016-06-20 22:27:55 +01:00
parent 22612bbcf4
commit ef5401d4c6
13 changed files with 817 additions and 1114 deletions

View File

@ -5,12 +5,20 @@ const path = require('path')
const arrayify = require('array-back')
const t = require('typical')
const CommandLineTool = require('command-line-tool')
const MiddlewareStack = require('./middleware-stack')
const DefaultStack = require('./default-stack')
const debug = require('./debug')
/**
* @module local-web-server
*/
const tool = new CommandLineTool()
class LocalWebServer extends MiddlewareStack {
/**
* @alias module:local-web-server
* @extends module:middleware-stack
*/
class LocalWebServer extends DefaultStack {
_init (options) {
this.options = this.options || Object.assign(options || {}, collectUserOptions(this.getOptionDefinitions()))
}
@ -83,7 +91,7 @@ class LocalWebServer extends MiddlewareStack {
}
function onServerUp (port, directory, isHttps) {
const ipList = getIPList(isHttps)
const ipList = getIPList()
.map(iface => `[underline]{${isHttps ? 'https' : 'http'}://${iface.address}:${port}}`)
.join(', ')
@ -94,7 +102,8 @@ function onServerUp (port, directory, isHttps) {
))
}
function getIPList (isHttps) {
function getIPList () {
const flatten = require('reduce-flatten')
const os = require('os')