Permalink
Browse files

reverts broken commit

  • Loading branch information...
1 parent 834a7d2 commit b0d5c58a727b184744a0a25e806532f0400197d6 @sintaxi committed Apr 5, 2016
Showing with 14 additions and 13 deletions.
  1. +14 −11 bin/harp
  2. +0 −2 lib/index.js
View
@@ -82,12 +82,16 @@ program
.description("Start a Harp server in current directory")
.action(function(path, program){
var projectPath = nodePath.resolve(process.cwd(), path || "")
- if(typeof program.ip == 'undefined') program.ip = '0.0.0.0'
- if(typeof program.port == 'undefined') program.port = 9000
- harp.server(projectPath, { ip: program.ip, port: program.port }, function(){
- var host = this.address()
- if(host.address == '0.0.0.0' || host.address == '127.0.0.1') host.address = 'localhost'
- var hostUrl = "http://" + host.address + ":" + host.port + "/"
+ var ip = program.ip || '0.0.0.0'
+ var port = program.port || 9000
+ harp.server(projectPath, { ip: ip, port: port }, function(){
+ var address = ''
+ if(ip == '0.0.0.0' || ip == '127.0.0.1') {
+ address = 'localhost'
+ } else {
+ address = ip
+ }
+ var hostUrl = "http://" + address + ":" + port + "/"
output("Your server is listening at " + hostUrl)
})
})
@@ -99,13 +103,12 @@ program
.description("Start a Harp server to host a directory of Harp projects")
.action(function(path, program){
var projectPath = nodePath.resolve(process.cwd(), path || "")
- if(typeof program.port == 'undefined') program.port = 9000
- harp.multihost(projectPath, { port: program.port }, function(){
- var host = this.address()
- if(host.port == "80"){
+ var port = program.port || 9000
+ harp.multihost(projectPath, { port: port }, function(){
+ if(port == "80"){
var loc = "http://harp.nu"
}else{
- var loc = "http://harp.nu:" + host.port
+ var loc = "http://harp.nu:" + port
}
output("Your server is hosting multiple projects at " + loc)
})
View
@@ -56,8 +56,6 @@ exports.multihost = function(dirPath, options, callback){
app.use(middleware.process)
app.use(middleware.fallback)
app.listen(options.port || 9000, callback)
-
- return app
}
/**

0 comments on commit b0d5c58

Please sign in to comment.