-
Notifications
You must be signed in to change notification settings - Fork 50
/
app.js
40 lines (31 loc) · 1 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
//general dependencies
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var router = express.Router();
var adminConfig = require('./config/adminconfig.js');
//database configuration
var mysql = require('mysql');
var connection = mysql.createConnection({
host: adminConfig.mysql.host,
user: adminConfig.mysql.username,
password: adminConfig.mysql.password,
database: 'schemeBeam',
socketPath: adminConfig.mysql.socketPath
});
connection.connect();
//route configuration
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
//internal app dependencies
var api = require('./api/api.js')(app, connection);
var routes = require('./routes/routes.js')(app, connection);
var auth = require('./authentication/auth.js')(app, connection);
//server initiation
var port = adminConfig.port;
app.listen(port, function() {
console.log('schemeBeam up and running on port ' + port);
});