forked from CloudBreadProject/CloudBread-NodeJS
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathapp.js
54 lines (47 loc) · 1.81 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
const express = require('express');
const path = require('path');
// const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const azureMobileApps = require('azure-mobile-apps');
const expressValidator = require('express-validator');
const expressStatusMonitor = require('express-status-monitor');
const errorHandler = require('errorhandler');
// require router
// const administrator = require('./routes/administrator');
// const game = require('./routes/game');
// const itemlisting = require('./routes/itemlisting');
// const login = require('./routes/login');
// const pushalarm = require('./routes/pushalarm');
// const signin = require('./routes/signin');
// const tableprocedure = require('./routes/tableprocedure');
const api = require('./routes/api');
const app = express();
// hompage : true => instance of Azure-Mobile-Apps for hompage
const mobile = azureMobileApps({ homePage: true });
// uncomment after placing your favicon in /public
// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(expressValidator());
app.use(expressStatusMonitor());
app.use(errorHandler());
// Setup Router
// app.use('/admin', administrator);
// app.use('/game', game);
// app.use('/item', itemlisting);
// app.use('/login', login);
// app.use('/alarm', pushalarm);
// app.use('/sign', signin);
// app.use('/table', tableprocedure);
app.use('/api', api);
// Azure Mobile Apps Initialization
// Define a table
mobile.tables.add('index');
// Add the mobile API so it is accessible as a Web API
app.use(mobile);
module.exports = app;