瀏覽代碼

added a 'listen' option

Webframe now listens by default even if you pass in your own server.
master
mortie 6 年之前
父節點
當前提交
73e9dfe945
共有 3 個檔案被更改,包括 6 行新增1 行删除
  1. 2
    0
      README.md
  2. 3
    0
      index.js
  3. 1
    1
      package.json

+ 2
- 0
README.md 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

Loading…
取消
儲存