add dotenv, start to add signup
This commit is contained in:
parent
0919cacc52
commit
341158579f
3 changed files with 2 additions and 14 deletions
|
@ -46,7 +46,7 @@
|
|||
"jwt-simple": "^0.5.0",
|
||||
"mongoose": "^4.4.16",
|
||||
"passport": "^0.3.2",
|
||||
"passport-github": "^1.1.0",g
|
||||
"passport-github": "^1.1.0",
|
||||
"passport-jwt": "^2.0.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"react": "^15.0.2",
|
||||
|
|
|
@ -9,6 +9,7 @@ export function newUser(req, res) {
|
|||
}
|
||||
|
||||
export function createUser(req, res, next) {
|
||||
console.log("in create user");
|
||||
const user = new User({
|
||||
username: req.body.username,
|
||||
email: req.body.email,
|
||||
|
|
|
@ -24,24 +24,11 @@ import serverConfig from './config';
|
|||
import users from './routes/user.routes';
|
||||
|
||||
//Body parser, cookie parser, sessions, serve public assets
|
||||
const MongoStore = require('connect-mongo')(session);
|
||||
|
||||
app.use(Express.static(path.resolve(__dirname, '../static')));
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
app.use(bodyParser.json());
|
||||
app.use(cookieParser());
|
||||
app.use(session({
|
||||
//this should be SECRET AND IN A SECRET FILE
|
||||
//TODO add dotenv
|
||||
secret: 'steve brule',
|
||||
resave: true,
|
||||
saveUninitialized: true,
|
||||
store: new MongoStore({
|
||||
// url: process.env.MONGODB_URI || process.env.MONGOLAB_URI,
|
||||
url: serverConfig.mongoURL,
|
||||
autoReconnect: true
|
||||
})
|
||||
}));
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
app.use('/', users);
|
||||
|
|
Loading…
Reference in a new issue