Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Configurable host using -h command-line option

  • Loading branch information...
commit 9b6434475b98a6f3873ebed01b5b6892b5f47be1 1 parent 2a773a8
@janjongboom janjongboom authored
Showing with 7 additions and 6 deletions.
  1. +6 −5 demo/server.js
  2. +1 −1  test/demo.js
View
11 demo/server.js
@@ -4,12 +4,12 @@ const PATH = require("path");
const ARCHITECT = require("architect");
-exports.main = function main(port, callback) {
+exports.main = function main(host, port, callback) {
var plugins = [
{
packagePath: "connect-architect/connect",
- host: "localhost",
+ host: host,
port: port
},
{
@@ -96,10 +96,11 @@ exports.main = function main(port, callback) {
}
if (require.main === module) {
-
+
+ var host = (process.argv.join(" ").match(/-h\s(\S*)/) || ["","localhost"])[1];
var port = parseInt(process.env.PORT || 8080, 10);
-
- exports.main(port, function(err) {
+
+ exports.main(host, port, function(err) {
if (err) {
console.error(err.stack);
process.exit(1);
View
2  test/demo.js
@@ -8,7 +8,7 @@ exports.main = function (callback) {
var port = parseInt(process.env.PORT || 8080, 10);
- DEMO_SERVER.main(port, function(err, app) {
+ DEMO_SERVER.main("localhost", port, function(err, app) {
if (err) return callback(err);
Please sign in to comment.
Something went wrong with that request. Please try again.