Permalink
Browse files

initial commit with angular-express-seed

  • Loading branch information...
1 parent bac2786 commit b563e1dfe2fb272541acbe194322545ef3df6a70 @mikepmunroe committed Feb 20, 2014
Showing 1,237 changed files with 181,767 additions and 0 deletions.
View
@@ -0,0 +1,61 @@
+
+/**
+ * Module dependencies
+ */
+
+var express = require('express'),
+ routes = require('./routes'),
+ api = require('./routes/api'),
+ http = require('http'),
+ path = require('path');
+
+var app = module.exports = express();
+
+
+/**
+ * Configuration
+ */
+
+// all environments
+app.set('port', process.env.PORT || 3000);
+app.set('views', __dirname + '/views');
+app.set('view engine', 'jade');
+app.use(express.logger('dev'));
+app.use(express.bodyParser());
+app.use(express.methodOverride());
+app.use(express.static(path.join(__dirname, 'public')));
+app.use(app.router);
+
+// development only
+if (app.get('env') === 'development') {
+ app.use(express.errorHandler());
+}
+
+// production only
+if (app.get('env') === 'production') {
+ // TODO
+};
+
+
+/**
+ * Routes
+ */
+
+// serve index and view partials
+app.get('/', routes.index);
+app.get('/partials/:name', routes.partials);
+
+// JSON API
+app.get('/api/name', api.name);
+
+// redirect all others to the index (HTML5 history)
+app.get('*', routes.index);
+
+
+/**
+ * Start Server
+ */
+
+http.createServer(app).listen(app.get('port'), function () {
+ console.log('Express server listening on port ' + app.get('port'));
+});
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit b563e1d

Please sign in to comment.