obrand-admin-server/obrand-server.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

/**
*
* User: Martin Donnelly
* Date: 2016-03-31
* Time: 09:44
*
*/
var express = require('express'), path = require('path'), http = require('http');
2016-04-04 08:59:37 +00:00
var session = require('session');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
2016-04-04 11:52:15 +00:00
var session = require('session');
var globSync = require('glob').sync;
var colors = require('colors/safe');
var app = express();
app.set('port', process.env.PORT || 8086);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.json({type: 'application/vnd.api+json'}));
2016-04-04 08:59:37 +00:00
app.use(cookieParser('!n87klqX39cB:7ayiRzEL5yRy5y938'));
app.use(session({
secret: 'G)+W&2W5C3V6gXJ.8mSD!l/-n3D]EV', resave: false,
saveUninitialized: false
}));
app.use('/export',express.static(path.join(__dirname,'server/static')));
app.use('/css',express.static(path.join(__dirname,'server/css')));
2016-04-04 08:59:37 +00:00
app.use('/',express.static(path.join(__dirname,'wwwroot')));
console.log(path.join(__dirname,'server/static'));
var backend = globSync('./server/app/**/*.js', { cwd: __dirname }).map(require);
backend.forEach(function(route) { route(app); });
app.listen(app.get('port'), function() {
'use strict';
console.log(colors.magenta('Obrand Server listening on ' + app.get('port')));
});