Quellcode durchsuchen

added CLI util

master
mortie vor 6 Jahren
Ursprung
Commit
3a020d1825
3 geänderte Dateien mit 27 neuen und 1 gelöschten Zeilen
  1. 7
    0
      README.md
  2. 16
    0
      cli.js
  3. 4
    1
      package.json

+ 7
- 0
README.md Datei anzeigen

@@ -17,6 +17,13 @@ var webframe = require("webframe");
var app = new webframe.App();
```

Or from the command line:

``` Bash
npm install -g webframe
webframe [directory]
```

The file example.js contains an example of a small web application.

## Why a new web framework?

+ 16
- 0
cli.js Datei anzeigen

@@ -0,0 +1,16 @@
#!/usr/bin/env node

if (process.argv[2] === "-h" || process.argv[2] === "--help") {
console.log("Usage: webframe [directory]");
console.log(" Create a web server in directory [dir] (or in the current directory).")
console.log(" Set the port (default 8080) with the PORT environment variable.");
console.log(" Set the host (default 127.0.0.1) with the HOSTNAME environment variable.");
process.exit(1);
}

var webframe = require(".");

var dir = process.argv[2] || ".";

var app = new webframe.App();
app.get("^.*", webframe.static(dir));

+ 4
- 1
package.json Datei anzeigen

@@ -1,6 +1,6 @@
{
"name": "webframe",
"version": "0.5.0",
"version": "0.6.0",
"description": "Web framework.",
"main": "index.js",
"scripts": {
@@ -10,6 +10,9 @@
"type": "git",
"url": "https://git.mort.coffee/mort/webframe"
},
"bin": {
"webframe": "cli.js"
},
"author": "Martin Dørum <martid0311@gmail.com> (http://mort.coffee)",
"license": "ISC"
}

Laden…
Abbrechen
Speichern