OSDN Git Service

fbd9877a3bdd5965090d2395111803752ee62354
[eos/base.git] / zephyr / server / routes.js
1 /**
2  * Main application routes
3  */
4
5 'use strict';
6
7 var errors = require('./components/errors');
8
9 module.exports = function(app) {
10
11   // Insert routes below
12   app.use('/api/upload', require('./api/upload'));
13   app.use('/api/workspace', require('./api/workspace'));
14   app.use('/api/option', require('./api/option'));
15   app.use('/api/tagList', require('./api/tagList'));
16   app.use('/api/commandList', require('./api/commandList'));
17   
18   // All undefined asset or api routes should return a 404
19   app.route('/:url(api|auth|components|app|bower_components|assets)/*')
20    .get(errors[404]);
21
22   // All other routes should redirect to the index.html
23   app.route('/*')
24     .get(function(req, res) {
25       res.sendfile(app.get('appPath') + '/index.html');
26     });
27 };