1
0
Fork 0
mirror of https://github.com/mmumshad/ansible-playable.git synced 2025-02-15 04:42:05 +00:00
ansible-playable/server/routes.js

31 lines
946 B
JavaScript
Raw Normal View History

2017-06-07 17:36:44 +00:00
/**
* Main application routes
*/
'use strict';
import errors from './components/errors';
import path from 'path';
2017-06-11 17:06:50 +00:00
import * as auth from './auth/auth.service';
2017-06-07 17:36:44 +00:00
export default function(app) {
// Insert routes below
app.use('/api/system', require('./api/system'));
2017-06-11 17:06:50 +00:00
app.use('/api/custom_modules', auth.isAuthenticated(), require('./api/custom_module'));
app.use('/api/ansible', auth.isAuthenticated(), require('./api/ansible'));
app.use('/api/projects', auth.isAuthenticated(), require('./api/project'));
2017-06-07 17:36:44 +00:00
app.use('/api/users', require('./api/user'));
app.use('/auth', require('./auth').default);
// All undefined asset or api routes should return a 404
app.route('/:url(api|auth|components|app|bower_components|assets)/*')
.get(errors[404]);
// All other routes should redirect to the index.html
app.route('/*')
.get((req, res) => {
res.sendFile(path.resolve(`${app.get('appPath')}/index.html`));
});
}