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

#161291007 Implement user profile update route #24

Merged
merged 2 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"presets": ["env"]
"presets": [
[ "@babel/env", {
"useBuiltIns": "usage"
}]
]
}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ dist
sendgrid.env
coverage
.nyc_output

# Multer file upload storage
uploads
15 changes: 10 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import swaggerDocument from './swagger.json';

import routes from './routes';

const app = express();

dotenv.config();

const port = process.env.PORT || 3000;
const options = {
explorer: true
};
const isProduction = process.env.NODE_ENV === 'production';

const app = express();

// TODO: add multer to parse form data
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
Expand Down Expand Up @@ -64,16 +66,19 @@ app.use((req, res, next) => {
next(err);
});

// development error handler
// will print stacktrace
// error handler
// will print stacktrace if not production
app.use((err, req, res, next) => {
res.status(err.status || 500);
res.json({
status: 'failure',
Darthrighteous marked this conversation as resolved.
Show resolved Hide resolved
errors: {
message: err.message,
error: err
}
});
if (!isProduction) {
next(err);
}
});

// eslint-disable-next-line max-len
Expand Down
Loading