| @@ -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? | |||
| @@ -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)); | |||
| @@ -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" | |||
| } | |||