-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.js
49 lines (37 loc) · 1.5 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var express = require('express');
var app = express();
var auth = express();
var admin = express();
var home = express();
var path = require('path');
[admin, auth, app, home].forEach(function(element, index, array){
element.use('/images', express.static(__dirname + '/app/resources/images'));
element.use('/scripts', express.static(__dirname + '/app/resources/bower'));
element.use('/scripts/core', express.static(__dirname + '/app/resources/core'));
element.use('/components', express.static(__dirname + '/app/resources/components'));
element.use('/styles', express.static(__dirname + '/app/resources/css'));
element.use('/vendor', express.static(__dirname + '/app/node_modules'));
element.use(function(req, res, next) {
res.setHeader('Authorization', 'Token token="' + process.env.API_TOKEN_AUTH + '"');
next();
});
});
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/app/masters/app/index.html'));
});
admin.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/app/masters/admin/index.html'));
});
auth.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/app/masters/auth/index.html'));
});
home.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/app/masters/home/index.html'));
});
app.use(['/auth'], auth);
app.use(['/admin'], admin);
app.use(['/home'], home);
app.set('port', (process.env.PORT || 5000));
app.listen(app.get('port'), function() {
console.log('Zueira F.C client app is running on port:', app.get('port'));
});