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

Commit

Permalink
feat(userProfile): implement user profile update
Browse files Browse the repository at this point in the history
- add profile columns to the user table
- build route to update a user's profile
- implement cloudinary image upload for profile avatars
- fix error handler

[Finishes #161291007]
  • Loading branch information
Andela-Jalil committed Nov 6, 2018
1 parent 3369d6b commit 4568327
Show file tree
Hide file tree
Showing 15 changed files with 809 additions and 180 deletions.
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 @@ -9,12 +9,14 @@ import session from 'express-session';

import routes from './routes';

const app = express();

dotenv.config();

const port = process.env.PORT || 3000;
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 @@ -54,16 +56,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',
errors: {
message: err.message,
error: err
}
});
if (!isProduction) {
// next(err);
}
});

// eslint-disable-next-line max-len
Expand Down
Binary file added mockdata/pngimage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions mockdata/svgimage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4568327

Please sign in to comment.