Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
Merge 6a9a598 into 0103461
Browse files Browse the repository at this point in the history
  • Loading branch information
KvNGCzA authored Nov 1, 2018
2 parents 0103461 + 6a9a598 commit de0b254
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 183 deletions.
29 changes: 13 additions & 16 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import bodyParser from 'body-parser';
import winston from 'winston';
import dotenv from 'dotenv';
import validator from 'express-validator';
import passport from 'passport';
import session from 'express-session';
import routes from './routes';

const app = express();
Expand All @@ -16,6 +18,15 @@ app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(validator());

app.use(session({
secret: process.env.SECRET,
resave: true,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());

app.use(routes);

// / catch 404 and forward to error handler
Expand All @@ -35,23 +46,9 @@ app.use((err, req, res, next) => {
error: err
}
});
next(err);
});

// production error handler
// no stacktraces leaked to user
app.use((err, req, res) => {
res.status(err.status || 500);
res.json({
errors: {
message: err.message,
error: {}
}
});
});

app.listen(port, () => {
winston.log('info', `App listening at localhost:${port}`);
});
app.listen(port, () => winston.log('info',
`App listening at localhost:${port}`));

export default app;
26 changes: 0 additions & 26 deletions config/passport.js

This file was deleted.

Loading

0 comments on commit de0b254

Please sign in to comment.