Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dandiflower/Footprint int…
Browse files Browse the repository at this point in the history
…o hannah
  • Loading branch information
hannahlim213 committed Jul 12, 2018
2 parents 97c9662 + 3278e9f commit 003a66f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 689 deletions.
14 changes: 12 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var bodyParser = require('body-parser');

const PORT = process.env.PORT || 3001;
var person = require('./routes/person');
var auth = require('./routes/auth');
var test = require('./routes/test');
var app = express();

// if (process.env.NODE_ENV === "production") {
app.use(express.static("client/build"));
// }


var mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
mongoose.connect('mongodb://localhost/mern-secure', { promiseLibrary: require('bluebird') })
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost/mern-secure', { promiseLibrary: require('bluebird') })
.then(() => console.log('connection succesful'))
.catch((err) => console.error(err));

Expand Down Expand Up @@ -41,4 +46,9 @@ app.use(function(err, req, res, next) {
res.render('error');
});

//Start the API server
app.listen(PORT, function () {
console.log(`🌎 ==> API Server now listening on PORT ${PORT}!`);
});

module.exports = app;
5 changes: 5 additions & 0 deletions bin/www → bin_bk/www
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
var app = require('../app');
var debug = require('debug')('mean-app:server');
var http = require('http');
var express = require('express');

/**
* Get port from environment and store in Express.
Expand All @@ -15,6 +16,10 @@ var http = require('http');
var port = normalizePort(process.env.PORT || '3001');
app.set('port', port);

if (process.env.NODE_ENV === "production") {
app.use(express.static("../client/build"));
}

/**
* Create HTTP server.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var JwtStrategy = require('passport-jwt').Strategy,
ExtractJwt = require('passport-jwt').ExtractJwt;

// load up the user model
var User = require('../models/user');
var User = require('../models/User');
var settings = require('../config/settings'); // get settings file

module.exports = function(passport) {
Expand Down
Loading

0 comments on commit 003a66f

Please sign in to comment.