mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 09:37:37 +00:00
Initial Commit
This commit is contained in:
36
lib/routes.js
Normal file
36
lib/routes.js
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user