-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
34 lines (28 loc) · 1.05 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
'use strict';
const stylus = require('stylus')
const bodyParser = require('body-parser')
const path = require('path')
const q = require('q')
const port = 7070
const cookieParser = require('cookie-parser')
const express = require('express')
const serveStatic = require('serve-static')
const apiRouter = require('./lib/api_router')
const database = require('./lib/database/dbinterface.js')
let app = express();
/*
* Here we are initializing routing rules and static file serving
* for all files in the web folder. To add additional routes, look at lib/router.js
*/
app.use(bodyParser.urlencoded({limit: '50mb', extended: true }));
app.use(bodyParser.json({limit: '50mb'}));
app.use(cookieParser());
app.use('/api', apiRouter);
app.use(stylus.middleware(path.join(__dirname, 'styles')));
app.use( express.static(__dirname + '/src') );
app.use( express.static(__dirname + '/node_modules') );
database.init()
.then( () => {
app.listen(process.env['PORT'] || port);
console.log('Started and listening on Port ' + port);
})