/** * * User: Martin Donnelly * Date: 2016-03-31 * Time: 09:44 * */ var express = require('express'), path = require('path'), http = require('http'); var session = require('session'); var morgan = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); 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'})); 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'))); 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'))); });