Permalink
Browse files

Updated README

  • Loading branch information...
ajlopez committed Dec 31, 2012
1 parent 1333c36 commit 5bd275956780567982834c1a4b8064b298276e59
Showing with 30 additions and 4 deletions.
  1. +30 −4 README.md
View
@@ -15,6 +15,34 @@ Reference in your program:
```js
var simpleweb = require('simpleweb');
```
+
+A simple web server:
+```js
+var simpleweb = require('simpleweb'),
+ http = require('http');
+
+var app = simpleweb();
+
+// Configuring middleware
+
+app.use(simpleweb.query());
+app.use(simpleweb.body());
+app.use(app.router);
+app.use(simpleweb.static(path.join(__dirname, 'public')));
+
+// Configuring routes
+
+app.get('/', function (req, res) { /* .... */ });
+app.get('/customer', function (req, res) { /* .... */ });
+app.get('/customer/new', function (req, res) { /* .... */ });
+app.post('/customer/new', function (req, res) { /* .... */ });
+app.get('/supplier', function (req, res) { /* .... */ });
+
+// Launch the web server
+
+var server = http.createServer(app).listen(8000);
+```
+
TBD
## Development
@@ -28,11 +56,9 @@ npm test
## Samples
-TBD
-
-## To do
+[Static](https://github.com/ajlopez/SimpleWeb/tree/master/samples/static) Simple site with static pages.
-TBD
+[Customers](https://github.com/ajlopez/SimpleWeb/tree/master/samples/customers) Dinamic pages, in-memory repository.
## Contribution

0 comments on commit 5bd2759

Please sign in to comment.