Browse Source

added a 'listen' option

Webframe now listens by default even if you pass in your own server.
master
mortie 6 years ago
parent
commit
73e9dfe945
3 changed files with 6 additions and 1 deletions
  1. 2
    0
      README.md
  2. 3
    0
      index.js
  3. 1
    1
      package.json

+ 2
- 0
README.md View File

@@ -45,6 +45,8 @@ Creates a new instance, with an optional options argument.
Options:

* `server`: Your own HTTP (like the one created by http.createHttpServer).
* `listen`: Whether to call the `listen` method on the server. Defaults to
true.
* `port`: The port to listen on. Defaults to the PORT environment variable, or
8080.
* `host`: The host to listen on. Defaults to the HOSTNAME environment variable,

+ 3
- 0
index.js View File

@@ -43,7 +43,10 @@ class App {
this.server = options.server;
} else {
this.server = http.createServer();
}

// Listen
if (options.listen !== false) {
var port = options.port || process.env.PORT || 8080;
var host = options.host || process.env.HOSTNAME || "127.0.0.1";


+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
{
"name": "webframe",
"version": "0.6.0",
"version": "0.7.0",
"description": "Web framework.",
"main": "index.js",
"scripts": {

Loading…
Cancel
Save