var express = require('express');
var morgan = require('morgan');
var bodyParser = require('body-parser');
let passport = require('passport');
var flash = require('connect-flash');
var session = require('express-session');
var serverConfig = require('./serverConfig.json');
var app = express();
app.set('port', (process.env.PORT || serverConfig.SERVER_PORT));

app.use(passport.initialize());

passportMiddleware = require('./middleware/passport.middleware');
app.use(flash());
app.use(session({
    cookie: { maxAge: 60000 },
    secret: 'capt@capt.com',
    resave: false,
    saveUninitialized: false
}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));


app.use(morgan('dev'));
//require('./connection');
require('./routes')(app,express);


app.listen(app.get('port'), function () {
   console.log('Listening on port' + serverConfig.SERVER_PORT + '...');
});

//ldap auth credt
//LDAP://10.112.130.15/DC=HCLT,DC=CORP,DC=HCL,DC=IN
 
//DomainList = “MYHCL,HCLTECH,HCLISD,GEO,PRIZM"
