Removed the unused application code (a new project PetitTetonMeteor now contains all this code reformulated into a Meteor app); Updated the sales sheet.
This commit is contained in:
106
server.js
106
server.js
@@ -5,8 +5,8 @@ var express = require('express');
|
||||
var app = module.exports.app = express();
|
||||
var server = http.createServer(app);
|
||||
var port = process.env.PORT || 8089;
|
||||
var passport = require('passport');
|
||||
var flash = require('connect-flash');
|
||||
//var passport = require('passport');
|
||||
//var flash = require('connect-flash');
|
||||
var path = require('path');
|
||||
var ejsPath = path.join(__dirname, 'public');
|
||||
var rootPath = path.join(__dirname, 'public');
|
||||
@@ -20,72 +20,66 @@ var FileStore = require('session-file-store')(session);
|
||||
|
||||
var moment = require('moment');
|
||||
var nodeMailer = require('nodemailer');
|
||||
//var configDB = require('./config/database.js');
|
||||
var config = require('./config');
|
||||
var models = require("./models");
|
||||
|
||||
//models.sequelize.sync().then(function () {
|
||||
//SMTP Transport setup.
|
||||
var smtpTransport = nodeMailer.createTransport({host: config.smtpHost, port: config.smtpPort, secure: true, ignoreTLS: false, requiresAuth: true, auth: {user: config.smtpUser, pass: config.smtpPassword}});
|
||||
//SMTP Transport setup.
|
||||
var smtpTransport = nodeMailer.createTransport({host: config.smtpHost, port: config.smtpPort, secure: true, ignoreTLS: false, requiresAuth: true, auth: {user: config.smtpUser, pass: config.smtpPassword}});
|
||||
|
||||
//Setup our passport configuration passing the user model.
|
||||
require('./app/passport')(passport, models.User); // pass passport for configuration
|
||||
//Setup our passport configuration passing the user model.
|
||||
//require('./app/passport')(passport, models.User); // pass passport for configuration
|
||||
|
||||
//Serve the fav icon before any logging.
|
||||
app.use(favicon(__dirname + '/public/images/Chicken.ico'));
|
||||
//Serve the fav icon before any logging.
|
||||
app.use(favicon(__dirname + '/public/images/Chicken.ico'));
|
||||
|
||||
//Setup NodeJS express.
|
||||
app.use(morgan('dev')); // log every request to the console
|
||||
app.use(cookieParser()); // read cookies (needed for auth)
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
app.use(bodyParser.json());
|
||||
//Setup NodeJS express.
|
||||
app.use(morgan('dev')); // log every request to the console
|
||||
app.use(cookieParser()); // read cookies (needed for auth)
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
//Setup Stylus to manage our awesome styles.
|
||||
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
|
||||
//Setup Stylus to manage our awesome styles.
|
||||
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
|
||||
|
||||
//Setup EJS for view templating.
|
||||
//app.engine('.ejs', require('ejs').__express);
|
||||
//app.engine('.ejs', require('ejs').renderFile);
|
||||
app.set('view engine', 'ejs'); //html
|
||||
app.set('views', ejsPath);
|
||||
//Setup EJS for view templating.
|
||||
//app.engine('.ejs', require('ejs').__express);
|
||||
//app.engine('.ejs', require('ejs').renderFile);
|
||||
app.set('view engine', 'ejs'); //html
|
||||
app.set('views', ejsPath);
|
||||
|
||||
//Static routes
|
||||
// Can add: maxAge: 1d, redirect: false, and setHeaders: ...
|
||||
app.use(express.static(rootPath, {dotfiles: 'deny', index: false, extensions: ['htm', 'html', 'gif', 'png', 'jpg', 'jpeg', 'map', 'css', 'js', 'ico', 'xml','txt','zip','pdf'], etag: false}));
|
||||
//Static routes
|
||||
// Can add: maxAge: 1d, redirect: false, and setHeaders: ...
|
||||
app.use(express.static(rootPath, {dotfiles: 'deny', index: false, extensions: ['htm', 'html', 'gif', 'png', 'jpg', 'jpeg', 'map', 'css', 'js', 'ico', 'xml','txt','zip','pdf'], etag: false}));
|
||||
|
||||
//Passport
|
||||
app.use(session({
|
||||
store: new FileStore({ttl: 12 * 60 * 60, encrypt: false}), //https://www.npmjs.com/package/session-file-store
|
||||
cookieName: 'session',
|
||||
secret: 'countingprogrammersinsteadofsheepleadstobettersleep',
|
||||
activeDuration: 12 * 60 * 60 * 1000,
|
||||
duration: 12 * 60 * 60 * 1000,
|
||||
httpOnly: true,
|
||||
secure: false,
|
||||
ephemeral: false
|
||||
}));
|
||||
app.use(flash()); // use connect-flash for flash messages stored in session
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session()); // persistent login sessions
|
||||
//Passport
|
||||
//app.use(session({
|
||||
// store: new FileStore({ttl: 12 * 60 * 60, encrypt: false}), //https://www.npmjs.com/package/session-file-store
|
||||
// cookieName: 'session',
|
||||
// secret: 'countingprogrammersinsteadofsheepleadstobettersleep',
|
||||
// activeDuration: 12 * 60 * 60 * 1000,
|
||||
// duration: 12 * 60 * 60 * 1000,
|
||||
// httpOnly: true,
|
||||
// secure: false,
|
||||
// ephemeral: false
|
||||
//}));
|
||||
//app.use(flash()); // Use connect-flash for flash messages stored in session.
|
||||
//app.use(passport.initialize());
|
||||
//app.use(passport.session()); // Persistent login sessions.
|
||||
|
||||
//Routes
|
||||
require('./app/routes.js')(app, rootPath, passport, smtpTransport, models.sequelize); // load our routes and pass in our app and fully configured passport
|
||||
//Routes
|
||||
require('./app/routes.js')(app, rootPath, smtpTransport); // Load our routes and pass in our app and fully configured passport.
|
||||
|
||||
//Setup the brainstorm communications system.
|
||||
//require('./brainstorm.js')(server, models.sequelize);
|
||||
//Setup the brainstorm communications system.
|
||||
//require('./brainstorm.js')(server, models.sequelize);
|
||||
|
||||
//Ensure we have an endsWith method in String.
|
||||
String.prototype.endsWith = function(suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
};
|
||||
//Ensure we have an endsWith method in String.
|
||||
String.prototype.endsWith = function(suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
};
|
||||
|
||||
//Launch
|
||||
server.listen(port);
|
||||
console.log('The magic happens on port ' + port);
|
||||
console.log("Root Path: " + rootPath);
|
||||
console.log("Time now is: " + moment(new Date()).format("MMM Do YYYY, h:mm:ss a"));
|
||||
//}).error(function(err) {
|
||||
// console.log("Couldn't create or initialize the database:" + err);
|
||||
//})
|
||||
//Launch
|
||||
server.listen(port);
|
||||
console.log('The magic happens on port ' + port);
|
||||
console.log("Root Path: " + rootPath);
|
||||
console.log("Time now is: " + moment(new Date()).format("MMM Do YYYY, h:mm:ss a"));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user