Permalink
Browse files

Update server task, make lint task.

Use `up` for serving so we can get that auto-reload goodness.
Use `jshint` for linting, because what else would we use?
Use `tap` for testing, though I haven't written any yet.
  • Loading branch information...
1 parent cc167c3 commit 3eb0cbd8f28395f16a433537732c3696d2fb2a9f @brianloveswords brianloveswords committed Oct 9, 2012
Showing with 26 additions and 8 deletions.
  1. +13 −0 .jshintrc
  2. +8 −2 Makefile
  3. +2 −5 app.js
  4. +3 −1 server.js
View
@@ -0,0 +1,13 @@
+{
+ "node": true,
+ "indent": 2,
+ "trailing": true,
+ "sub": true,
+ "white": true,
+ "laxbreak": true,
+ "noarg": true,
+ "undef": true,
+ "lastsemic": true,
+ "strict": false,
+ "es5": true
+}
View
@@ -1,4 +1,10 @@
server:
- @node server.js
+ @up -t 0 -n 1 -w -p 3000 server.js
-.PHONY: server
+lint:
+ @jshint *.js lib/*.js
+
+test:
+ @tap test/*.test.js
+
+.PHONY: server test lint
View
7 app.js
@@ -13,13 +13,11 @@ var app = express();
var logger = app.logger = require('./lib/logger');
var env = app.env = require('./lib/environment');
-logger.info('Environment: \n' + util.inspect(env.all()));
-
(new nunjucks.Environment(
new nunjucks.FileSystemLoader('views')
)).express(app);
-app.configure(function() {
+app.configure(function () {
app.set('port', process.env.PORT || 3000);
app.use(express.favicon());
app.use(express.logger('dev'));
@@ -35,7 +33,7 @@ app.configure(function() {
app.use(app.router);
});
-app.configure('development', function() {
+app.configure('development', function () {
app.use(express.errorHandler());
});
@@ -53,5 +51,4 @@ app.put('/behavior/:name', behavior.update);
app.patch('/behavior/:name', behavior.update);
app.delete('/behavior/:name', behavior.destroy);
-
module.exports = app;
View
@@ -1,9 +1,11 @@
var http = require('http');
var app = require('./app');
+var util = require('util');
var server = module.exports = http.createServer(app);
+console.log('Environment: \n' + util.inspect(app.env.all()));
if (!module.parent) {
- server.listen(app.get('port'), function() {
+ server.listen(app.get('port'), function () {
app.logger.info("Express server listening on port " + app.get('port'));
});
}

0 comments on commit 3eb0cbd

Please sign in to comment.