Permalink
Browse files

Add examples

  • Loading branch information...
Carlos Rodriguez
Carlos Rodriguez committed Jul 22, 2012
1 parent 9439f87 commit 18c7f8cef4ea8d9b179c1fcd139d321e6d5cea70
Showing with 15 additions and 0 deletions.
  1. +15 −0 examples/simple.js
View
@@ -0,0 +1,15 @@
+var accesslog = require('../')()
+ , http = require('http')
+ , port = 3000
+ ;
+
+http.createServer(function(req, res) {
+ accesslog(req, res, function() {
+ var content = JSON.stringify({'hello': 'world'});
+ res.writeHead(200, {'Content-Type': 'application/json', 'Content-Length': content.length});
+ res.write(content);
+ res.end();
+ });
+}).listen(port, function() {
+ console.log('test server listening on port ' + port);
+});

0 comments on commit 18c7f8c

Please sign in to comment.