-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
54 lines (44 loc) · 1.46 KB
/
app.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
50
51
52
53
54
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cors = require('cors');
var app = express();
// setup Sockets
var http = require('./sockets/mobile')(app);
// ROUTES
var adminRoute = require('./routes/admin');
var logs = require('./routes/logs');
var globals = require('./routes/globals');
var campaigns = require('./routes/campaigns');
var catalogues = require('./routes/catalogues');
var categories = require('./routes/categories');
var products = require('./routes/products');
var attributes = require('./routes/attributes');
var orders = require('./routes/orders');
var UserManagment = require('./users/users').App;
var UserMiddle = require('./users/users').Middleware;
var sessionHandler = require('./routes/session');
app.use(logger('dev'));
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(UserMiddle);
app.use(express.static(path.join(__dirname, 'files')));
app.use('/check', sessionHandler);
app.use('/users', UserManagment);
app.use('/log', logs);
app.use('/admin', adminRoute);
app.use('/campaigns', campaigns);
app.use('/catalogues', catalogues);
app.use('/globals', globals);
app.use('/categories', categories);
app.use('/products', products);
app.use('/attributes', attributes);
app.use('/orders', orders);
module.exports = {
App: app,
Http: http
};