summaryrefslogtreecommitdiff
path: root/bin/app.js
blob: eeec8d5cb70207f958376efdefedb3bfc3bb3f3e (plain)
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
var express = require('express'),
    expressValidator = require('express-validator'),
    fs = require('fs-extra'),
    morgan = require('morgan'),
    multer = require('multer'),
    cookieParser = require('cookie-parser'),
    bodyParser = require('body-parser'),
    cookieSession = require('cookie-session');
var config = require('../config/main');
var everyauth = require('everyauth');

var app = express();
app.use(morgan('combined'));
app.use(multer({inMemory: true}));
app.use(expressValidator());
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.use(cookieParser('some secret'));
app.use(express.session());
app.use(everyauth.middleware(app));
//app.use(cookieSession({secret: 'app_1'}));
app.use(express.static('../public'));
app.use(express.static('../public/vendor'));
//app.use(express.favicon(__dirname + '/public/images/shortcut-icon.png'));
//app.use(messages());

//Important - Some OAuth Providers do not allow callbacks to localhost,
// so you will need to create a localhost alias called local.host. Make
// sure you set up your /etc/hosts so that 127.0.0.1 is also associated 
//with 'local.host'. So inside your /etc/hosts file,
// one of the lines will look like:
//
//127.0.0.1   localhost local.host
//ABORT ABORT 
//this project needs to be updated to not use connect
//CONTINUE LATER...for the time being use passport
//
//
//
//

//


app.set('view engine', 'ejs');
app.set('views', 'views');

// view caching
app.set('view cache', false);

require('../config/routes')(app);
app.listen(config.webserver_port, function(){
  console.log('Listening on port '+config.webserver_port);
});