Initial Commit

This commit is contained in:
Fergal Moran
2014-03-20 11:32:56 +00:00
commit d49dc8b3bf
63 changed files with 3176 additions and 0 deletions

36
lib/routes.js Normal file
View File

@@ -0,0 +1,36 @@
'use strict';
var api = require('./controllers/api'),
index = require('./controllers'),
users = require('./controllers/users'),
promotions = require('./controllers/promotions'),
session = require('./controllers/session');
var middleware = require('./middleware');
/**
* Application routes
*/
module.exports = function(app) {
// Server API Routes
app.get('/api/awesomeThings', api.awesomeThings);
app.get('/api/promotions', promotions.list);
app.post('/api/users', users.create);
app.put('/api/users', users.changePassword);
app.get('/api/users/me', users.me);
app.get('/api/users/:id', users.show);
app.post('/api/session', session.login);
app.del('/api/session', session.logout);
// All undefined api routes should return a 404
app.get('/api/*', function(req, res) {
res.send(404);
});
// All other routes to use Angular routing in app/scripts/app.js
app.get('/partials/*', index.partials);
app.get('/*', middleware.setUserCookie, index.index);
};