2014-12-22 16:16:10 -08:00
|
|
|
require('dotenv').load();
|
2015-03-22 22:18:01 -07:00
|
|
|
// handle uncaught exceptions. Forever will restart process on shutdown
|
|
|
|
process.on('uncaughtException', function (err) {
|
|
|
|
console.error(
|
|
|
|
(new Date()).toUTCString() + ' uncaughtException:',
|
|
|
|
err.message
|
|
|
|
);
|
|
|
|
console.error(err.stack);
|
|
|
|
/* eslint-disable no-process-exit */
|
|
|
|
process.exit(1);
|
|
|
|
/* eslint-enable no-process-exit */
|
|
|
|
});
|
2014-01-11 22:53:31 -05:00
|
|
|
|
2014-12-23 08:48:28 -08:00
|
|
|
var express = require('express'),
|
2015-04-14 15:36:02 -04:00
|
|
|
accepts = require('accepts'),
|
|
|
|
cookieParser = require('cookie-parser'),
|
|
|
|
compress = require('compression'),
|
|
|
|
session = require('express-session'),
|
|
|
|
logger = require('morgan'),
|
|
|
|
errorHandler = require('errorhandler'),
|
|
|
|
methodOverride = require('method-override'),
|
|
|
|
bodyParser = require('body-parser'),
|
|
|
|
helmet = require('helmet'),
|
2015-06-01 18:30:43 -04:00
|
|
|
//frameguard = require('frameguard'),
|
|
|
|
//csp = require('helmet-csp'),
|
2015-04-14 15:36:02 -04:00
|
|
|
MongoStore = require('connect-mongo')(session),
|
|
|
|
flash = require('express-flash'),
|
|
|
|
path = require('path'),
|
|
|
|
mongoose = require('mongoose'),
|
|
|
|
passport = require('passport'),
|
|
|
|
expressValidator = require('express-validator'),
|
|
|
|
request = require('request'),
|
2015-05-01 16:34:07 -04:00
|
|
|
forceDomain = require('forcedomain'),
|
2015-05-03 16:45:34 -07:00
|
|
|
lessMiddleware = require('less-middleware'),
|
2014-01-11 22:53:31 -05:00
|
|
|
|
2015-05-25 19:55:18 -04:00
|
|
|
/**
|
|
|
|
* Controllers (route handlers).
|
|
|
|
*/
|
2015-06-01 18:30:43 -04:00
|
|
|
homeController = require('./boot/home'),
|
|
|
|
resourcesController = require('./resources/resources'),
|
|
|
|
userController = require('./boot/user'),
|
|
|
|
nonprofitController = require('./boot/nonprofits'),
|
|
|
|
fieldGuideController = require('./boot/fieldGuide'),
|
|
|
|
challengeMapController = require('./boot/challengeMap'),
|
|
|
|
challengeController = require('./boot/challenge'),
|
|
|
|
jobsController = require('./boot/jobs'),
|
|
|
|
redirects = require('./boot/redirects'),
|
|
|
|
utility = require('./boot/utility'),
|
|
|
|
storyController = require('./boot/story'),
|
2014-01-11 22:53:31 -05:00
|
|
|
|
2015-05-19 22:31:01 -04:00
|
|
|
/**
|
|
|
|
* API keys and Passport configuration.
|
|
|
|
*/
|
2015-06-01 18:30:43 -04:00
|
|
|
secrets = require('./../config/secrets'),
|
|
|
|
passportConf = require('./../config/passport');
|
2013-11-26 23:15:13 -05:00
|
|
|
|
2014-02-02 05:38:38 -05:00
|
|
|
/**
|
|
|
|
* Create Express server.
|
|
|
|
*/
|
|
|
|
var app = express();
|
|
|
|
|
2014-01-11 22:53:31 -05:00
|
|
|
/**
|
2014-06-06 14:58:30 -04:00
|
|
|
* Connect to MongoDB.
|
2014-01-11 22:53:31 -05:00
|
|
|
*/
|
2014-02-25 22:39:28 -05:00
|
|
|
mongoose.connect(secrets.db);
|
2015-01-16 18:58:27 -05:00
|
|
|
mongoose.connection.on('error', function () {
|
2015-05-25 19:55:18 -04:00
|
|
|
console.error(
|
|
|
|
'MongoDB Connection Error. Please make sure that MongoDB is running.'
|
|
|
|
);
|
2014-01-11 22:53:31 -05:00
|
|
|
});
|
2013-11-13 12:32:22 -05:00
|
|
|
|
2014-05-06 00:44:30 -04:00
|
|
|
/**
|
|
|
|
* Express configuration.
|
|
|
|
*/
|
2014-04-18 14:29:30 -04:00
|
|
|
|
2015-02-17 15:35:16 -08:00
|
|
|
|
2014-01-11 22:53:31 -05:00
|
|
|
app.set('port', process.env.PORT || 3000);
|
|
|
|
app.set('views', path.join(__dirname, 'views'));
|
|
|
|
app.set('view engine', 'jade');
|
2015-04-22 14:53:58 -07:00
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
2015-05-01 16:34:07 -04:00
|
|
|
app.use(forceDomain({
|
|
|
|
hostname: 'www.freecodecamp.com'
|
|
|
|
}));
|
2015-04-22 14:53:58 -07:00
|
|
|
}
|
|
|
|
|
2014-06-06 14:58:30 -04:00
|
|
|
app.use(compress());
|
2015-05-03 16:45:34 -07:00
|
|
|
app.use(lessMiddleware(__dirname + '/public'));
|
2014-04-12 12:43:07 -04:00
|
|
|
app.use(logger('dev'));
|
|
|
|
app.use(bodyParser.json());
|
2015-01-16 18:58:27 -05:00
|
|
|
app.use(bodyParser.urlencoded({extended: true}));
|
2014-12-23 18:20:53 -08:00
|
|
|
app.use(expressValidator({
|
2015-05-25 19:55:18 -04:00
|
|
|
customValidators: {
|
|
|
|
matchRegex: function (param, regex) {
|
|
|
|
return regex.test(param);
|
2014-12-23 18:20:53 -08:00
|
|
|
}
|
2015-05-25 19:55:18 -04:00
|
|
|
}
|
2014-12-23 18:20:53 -08:00
|
|
|
}));
|
2014-04-12 12:43:07 -04:00
|
|
|
app.use(methodOverride());
|
|
|
|
app.use(cookieParser());
|
|
|
|
app.use(session({
|
2015-04-14 15:36:02 -04:00
|
|
|
resave: true,
|
|
|
|
saveUninitialized: true,
|
|
|
|
secret: secrets.sessionSecret,
|
|
|
|
store: new MongoStore({
|
|
|
|
url: secrets.db,
|
2015-04-16 23:16:55 -07:00
|
|
|
'autoReconnect': true
|
2015-04-14 15:36:02 -04:00
|
|
|
})
|
2014-01-29 00:49:09 -05:00
|
|
|
}));
|
2014-01-11 22:53:31 -05:00
|
|
|
app.use(passport.initialize());
|
|
|
|
app.use(passport.session());
|
2014-06-01 11:52:28 -04:00
|
|
|
app.use(flash());
|
2014-12-10 20:44:33 -08:00
|
|
|
app.disable('x-powered-by');
|
2014-12-23 08:48:28 -08:00
|
|
|
|
2014-12-10 20:44:33 -08:00
|
|
|
app.use(helmet.xssFilter());
|
2015-01-09 15:10:34 -08:00
|
|
|
app.use(helmet.noSniff());
|
2015-05-06 19:10:03 -04:00
|
|
|
app.use(helmet.frameguard());
|
2015-02-17 15:35:16 -08:00
|
|
|
app.use(function(req, res, next) {
|
2015-05-25 19:55:18 -04:00
|
|
|
res.header('Access-Control-Allow-Origin', '*');
|
|
|
|
res.header('Access-Control-Allow-Headers',
|
|
|
|
'Origin, X-Requested-With, Content-Type, Accept'
|
|
|
|
);
|
|
|
|
next();
|
2015-02-17 15:35:16 -08:00
|
|
|
});
|
2014-12-23 08:48:28 -08:00
|
|
|
|
2014-12-22 12:36:45 -08:00
|
|
|
var trusted = [
|
2015-04-14 15:36:02 -04:00
|
|
|
"'self'",
|
2015-05-06 18:14:00 -04:00
|
|
|
'blob:',
|
2015-04-14 15:36:02 -04:00
|
|
|
'*.freecodecamp.com',
|
2015-05-06 19:10:03 -04:00
|
|
|
'http://www.freecodecamp.com',
|
|
|
|
'ws://freecodecamp.com/',
|
|
|
|
'ws://www.freecodecamp.com/',
|
2015-04-14 15:36:02 -04:00
|
|
|
'*.gstatic.com',
|
|
|
|
'*.google-analytics.com',
|
|
|
|
'*.googleapis.com',
|
|
|
|
'*.google.com',
|
|
|
|
'*.gstatic.com',
|
|
|
|
'*.doubleclick.net',
|
|
|
|
'*.twitter.com',
|
|
|
|
'*.twitch.tv',
|
|
|
|
'*.twimg.com',
|
|
|
|
"'unsafe-eval'",
|
|
|
|
"'unsafe-inline'",
|
|
|
|
'*.bootstrapcdn.com',
|
|
|
|
'*.cloudflare.com',
|
|
|
|
'https://*.cloudflare.com',
|
|
|
|
'localhost:3001',
|
|
|
|
'ws://localhost:3001/',
|
|
|
|
'http://localhost:3001',
|
|
|
|
'localhost:3000',
|
|
|
|
'ws://localhost:3000/',
|
|
|
|
'http://localhost:3000',
|
|
|
|
'*.ionicframework.com',
|
|
|
|
'https://syndication.twitter.com',
|
|
|
|
'*.youtube.com',
|
|
|
|
'*.jsdelivr.net',
|
|
|
|
'https://*.jsdelivr.net',
|
|
|
|
'*.ytimg.com',
|
2015-04-14 23:04:54 -04:00
|
|
|
'*.bitly.com',
|
|
|
|
'http://cdn.inspectlet.com/',
|
2015-05-28 16:40:22 -07:00
|
|
|
'wss://inspectletws.herokuapp.com/',
|
|
|
|
'http://hn.inspectlet.com/'
|
2014-12-22 12:36:45 -08:00
|
|
|
];
|
2014-12-22 13:38:48 -08:00
|
|
|
|
2015-05-06 19:10:03 -04:00
|
|
|
app.use(helmet.csp({
|
2015-05-25 19:55:18 -04:00
|
|
|
defaultSrc: trusted,
|
|
|
|
scriptSrc: [
|
|
|
|
'*.optimizely.com',
|
|
|
|
'*.aspnetcdn.com',
|
|
|
|
'*.d3js.org'
|
|
|
|
].concat(trusted),
|
|
|
|
'connect-src': [
|
|
|
|
].concat(trusted),
|
|
|
|
styleSrc: trusted,
|
|
|
|
imgSrc: [
|
|
|
|
/* allow all input since we have user submitted images for public profile*/
|
|
|
|
'*'
|
|
|
|
].concat(trusted),
|
|
|
|
fontSrc: ['*.googleapis.com'].concat(trusted),
|
|
|
|
mediaSrc: [
|
|
|
|
'*.amazonaws.com',
|
|
|
|
'*.twitter.com'
|
|
|
|
].concat(trusted),
|
|
|
|
frameSrc: [
|
|
|
|
|
|
|
|
'*.gitter.im',
|
|
|
|
'*.gitter.im https:',
|
|
|
|
'*.vimeo.com',
|
|
|
|
'*.twitter.com',
|
|
|
|
'*.ghbtns.com'
|
|
|
|
].concat(trusted),
|
|
|
|
reportOnly: false, // set to true if you only want to report errors
|
|
|
|
setAllHeaders: false, // set to true if you want to set all headers
|
|
|
|
safari5: false // set to true if you want to force buggy CSP in Safari 5
|
2014-12-10 20:44:33 -08:00
|
|
|
}));
|
2014-11-19 15:30:36 -08:00
|
|
|
|
2015-01-16 18:58:27 -05:00
|
|
|
app.use(function (req, res, next) {
|
2015-04-14 15:36:02 -04:00
|
|
|
// Make user object available in templates.
|
|
|
|
res.locals.user = req.user;
|
|
|
|
next();
|
2014-01-11 22:53:31 -05:00
|
|
|
});
|
2014-11-19 15:30:36 -08:00
|
|
|
|
2015-05-06 09:10:15 -04:00
|
|
|
app.use(express.static(__dirname + '/public', {maxAge: 86400000 }));
|
|
|
|
|
2015-01-16 18:58:27 -05:00
|
|
|
app.use(function (req, res, next) {
|
2015-05-25 19:55:18 -04:00
|
|
|
// Remember original destination before login.
|
|
|
|
var path = req.path.split('/')[1];
|
|
|
|
if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) {
|
|
|
|
return next();
|
|
|
|
} else if (/\/stories\/comments\/\w+/i.test(req.path)) {
|
|
|
|
return next();
|
|
|
|
}
|
|
|
|
req.session.returnTo = req.path;
|
|
|
|
next();
|
2014-03-08 14:58:27 -05:00
|
|
|
});
|
2014-11-19 15:30:36 -08:00
|
|
|
|
2015-03-30 15:15:07 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Nonprofit Project routes.
|
|
|
|
*/
|
|
|
|
|
2015-04-08 14:36:05 -07:00
|
|
|
app.get('/nonprofits/directory', nonprofitController.nonprofitsDirectory);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2015-03-30 18:02:50 -07:00
|
|
|
app.get(
|
2015-05-25 19:55:18 -04:00
|
|
|
'/nonprofits/:nonprofitName',
|
|
|
|
nonprofitController.returnIndividualNonprofit
|
2015-03-30 18:02:50 -07:00
|
|
|
);
|
|
|
|
|
2015-05-22 19:30:56 -07:00
|
|
|
app.get(
|
|
|
|
'/jobs',
|
2015-05-28 16:40:22 -07:00
|
|
|
jobsController.jobsDirectory
|
2015-05-22 19:30:56 -07:00
|
|
|
);
|
|
|
|
|
2015-02-15 23:59:03 -08:00
|
|
|
|
2015-04-24 13:49:32 -04:00
|
|
|
|
2015-02-15 23:59:03 -08:00
|
|
|
|
2015-03-07 18:26:49 +09:00
|
|
|
|
2015-03-06 08:11:18 +09:00
|
|
|
|
2015-03-06 09:20:30 +09:00
|
|
|
|
2015-06-01 18:30:43 -04:00
|
|
|
/**
|
|
|
|
* Camper News routes.
|
|
|
|
*/
|
2015-03-03 19:23:56 +09:00
|
|
|
|
2015-04-30 23:41:40 -07:00
|
|
|
|
|
|
|
|
2014-11-19 15:30:36 -08:00
|
|
|
app.all('/account', passportConf.isAuthenticated);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2015-01-27 20:12:51 -05:00
|
|
|
|
2015-02-16 23:35:02 -08:00
|
|
|
/**
|
|
|
|
* API routes
|
|
|
|
*/
|
|
|
|
|
2015-04-29 08:00:57 -04:00
|
|
|
|
2015-03-30 13:48:54 -07:00
|
|
|
/**
|
2015-04-08 17:18:51 -07:00
|
|
|
* Field Guide related routes
|
2015-03-30 13:48:54 -07:00
|
|
|
*/
|
2015-05-23 18:39:30 -07:00
|
|
|
app.get('/field-guide/all-articles', fieldGuideController.showAllFieldGuides);
|
2015-03-30 13:48:54 -07:00
|
|
|
|
2015-04-29 19:30:51 -04:00
|
|
|
app.get('/field-guide/:fieldGuideName',
|
2015-05-25 19:55:18 -04:00
|
|
|
fieldGuideController.returnIndividualFieldGuide
|
|
|
|
);
|
2015-04-05 16:44:07 -07:00
|
|
|
|
2015-04-24 13:49:32 -04:00
|
|
|
app.get('/field-guide/', fieldGuideController.returnNextFieldGuide);
|
2015-04-05 16:44:07 -07:00
|
|
|
|
2015-04-08 17:18:51 -07:00
|
|
|
app.post('/completed-field-guide/', fieldGuideController.completedFieldGuide);
|
2015-02-22 16:27:38 +09:00
|
|
|
|
2015-01-24 00:44:08 -05:00
|
|
|
|
2015-02-01 23:35:27 -08:00
|
|
|
/**
|
2015-05-20 22:31:20 -04:00
|
|
|
* Challenge related routes
|
2015-02-01 23:35:27 -08:00
|
|
|
*/
|
|
|
|
|
2015-05-25 19:55:18 -04:00
|
|
|
app.get('/challenges/next-challenge',
|
|
|
|
userController.userMigration,
|
2015-05-25 17:52:00 -07:00
|
|
|
challengeController.returnNextChallenge
|
|
|
|
);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2015-02-01 23:35:27 -08:00
|
|
|
app.get(
|
2015-05-25 19:55:18 -04:00
|
|
|
'/challenges/:challengeName',
|
|
|
|
userController.userMigration,
|
|
|
|
challengeController.returnIndividualChallenge
|
2015-02-01 23:35:27 -08:00
|
|
|
);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2015-05-25 19:55:18 -04:00
|
|
|
app.get('/challenges/',
|
|
|
|
userController.userMigration,
|
|
|
|
challengeController.returnCurrentChallenge);
|
2015-05-19 22:31:01 -04:00
|
|
|
// todo refactor these routes
|
|
|
|
app.post('/completed-challenge/', challengeController.completedChallenge);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2015-03-29 20:39:41 +09:00
|
|
|
app.post('/completed-zipline-or-basejump',
|
2015-05-19 22:31:01 -04:00
|
|
|
challengeController.completedZiplineOrBasejump);
|
|
|
|
|
|
|
|
app.post('/completed-bonfire', challengeController.completedBonfire);
|
2015-02-01 23:35:27 -08:00
|
|
|
|
2015-01-27 20:12:51 -05:00
|
|
|
// Unique Check API route
|
2015-03-30 15:15:07 -07:00
|
|
|
|
|
|
|
|
2015-03-30 18:02:50 -07:00
|
|
|
|
2014-02-01 03:30:14 -05:00
|
|
|
/**
|
2014-06-06 14:58:30 -04:00
|
|
|
* OAuth sign-in routes.
|
2014-02-01 03:30:14 -05:00
|
|
|
*/
|
2014-12-23 13:50:14 -08:00
|
|
|
|
|
|
|
var passportOptions = {
|
2015-04-14 15:36:02 -04:00
|
|
|
successRedirect: '/',
|
|
|
|
failureRedirect: '/login'
|
2014-12-23 13:50:14 -08:00
|
|
|
};
|
|
|
|
|
2015-01-17 18:52:58 -08:00
|
|
|
app.get('/auth/twitter', passport.authenticate('twitter'));
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2014-11-19 15:30:36 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/twitter/callback',
|
|
|
|
passport.authenticate('twitter', {
|
|
|
|
successRedirect: '/',
|
|
|
|
failureRedirect: '/login'
|
|
|
|
})
|
2014-12-23 13:50:14 -08:00
|
|
|
);
|
|
|
|
|
2014-11-19 15:30:36 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/linkedin',
|
|
|
|
passport.authenticate('linkedin', {
|
|
|
|
state: 'SOME STATE'
|
|
|
|
})
|
2014-12-23 13:50:14 -08:00
|
|
|
);
|
2014-11-19 15:30:36 -08:00
|
|
|
|
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/linkedin/callback',
|
|
|
|
passport.authenticate('linkedin', passportOptions)
|
2014-12-23 13:50:14 -08:00
|
|
|
);
|
2014-11-19 15:30:36 -08:00
|
|
|
|
2014-12-23 08:48:28 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/facebook',
|
|
|
|
passport.authenticate('facebook', {scope: ['email', 'user_location']})
|
2014-12-23 08:48:28 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/facebook/callback',
|
|
|
|
passport.authenticate('facebook', passportOptions), function (req, res) {
|
|
|
|
res.redirect(req.session.returnTo || '/');
|
|
|
|
}
|
2014-12-23 08:48:28 -08:00
|
|
|
);
|
2014-11-29 22:22:27 -08:00
|
|
|
|
|
|
|
app.get('/auth/github', passport.authenticate('github'));
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2014-12-23 08:48:28 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/github/callback',
|
|
|
|
passport.authenticate('github', passportOptions), function (req, res) {
|
|
|
|
res.redirect(req.session.returnTo || '/');
|
|
|
|
}
|
2014-12-23 08:48:28 -08:00
|
|
|
);
|
2014-11-29 22:22:27 -08:00
|
|
|
|
2014-12-23 08:48:28 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/google',
|
|
|
|
passport.authenticate('google', {scope: 'profile email'})
|
2014-12-23 08:48:28 -08:00
|
|
|
);
|
2015-03-30 15:15:07 -07:00
|
|
|
|
2014-12-23 08:48:28 -08:00
|
|
|
app.get(
|
2015-04-14 15:36:02 -04:00
|
|
|
'/auth/google/callback',
|
|
|
|
passport.authenticate('google', passportOptions), function (req, res) {
|
|
|
|
res.redirect(req.session.returnTo || '/');
|
|
|
|
}
|
2014-12-23 08:48:28 -08:00
|
|
|
);
|
2014-11-29 22:22:27 -08:00
|
|
|
|
2015-01-11 00:45:22 -05:00
|
|
|
|
2014-11-19 15:30:36 -08:00
|
|
|
/**
|
|
|
|
* 500 Error Handler.
|
|
|
|
*/
|
2015-03-24 08:03:59 -07:00
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
app.use(errorHandler({ log: true }));
|
|
|
|
} else {
|
|
|
|
// error handling in production
|
|
|
|
app.use(function(err, req, res, next) {
|
|
|
|
|
|
|
|
// respect err.status
|
|
|
|
if (err.status) {
|
|
|
|
res.statusCode = err.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
// default status code to 500
|
|
|
|
if (res.statusCode < 400) {
|
|
|
|
res.statusCode = 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse res type
|
|
|
|
var accept = accepts(req);
|
|
|
|
var type = accept.type('html', 'json', 'text');
|
|
|
|
|
|
|
|
var message = 'opps! Something went wrong. Please try again later';
|
|
|
|
if (type === 'html') {
|
|
|
|
req.flash('errors', { msg: message });
|
|
|
|
return res.redirect('/');
|
2015-04-14 15:36:02 -04:00
|
|
|
// json
|
2015-03-24 08:03:59 -07:00
|
|
|
} else if (type === 'json') {
|
|
|
|
res.setHeader('Content-Type', 'application/json');
|
|
|
|
return res.send({ message: message });
|
2015-04-14 15:36:02 -04:00
|
|
|
// plain text
|
2015-03-24 08:03:59 -07:00
|
|
|
} else {
|
|
|
|
res.setHeader('Content-Type', 'text/plain');
|
|
|
|
return res.send(message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2014-11-19 15:30:36 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Start Express server.
|
|
|
|
*/
|
2015-04-22 14:53:58 -07:00
|
|
|
|
2015-01-16 18:58:27 -05:00
|
|
|
app.listen(app.get('port'), function () {
|
2015-04-14 15:36:02 -04:00
|
|
|
console.log(
|
|
|
|
'FreeCodeCamp server listening on port %d in %s mode',
|
|
|
|
app.get('port'),
|
|
|
|
app.get('env')
|
|
|
|
);
|
2014-11-19 15:30:36 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = app;
|