Permalink
Browse files

Add support for serving static files and logging

  • Loading branch information...
1 parent 3e8722d commit b33eafc06f6f89166cecd8cde664c470cc249b31 @aron aron committed Apr 17, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/app.js
View
@@ -1,7 +1,19 @@
-var app = require("express")();
+var express = require('express'),
+ path = require('path'),
+ app = express();
+
+app.root = path.join(__dirname, '..', 'public');
+
+app.use(express.logger());
+app.use(express.static(app.root));
app.get('/', function (req, res) {
res.send('c\'est ne une jsbin');
});
-app.listen(3000);
+module.exports = app;
+
+// Run a local development server if this file is called directly.
+if (require.main === module) {
+ app.listen(3000);
+}

0 comments on commit b33eafc

Please sign in to comment.