-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task solution #237
base: master
Are you sure you want to change the base?
task solution #237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Just a few minor fixes are required
src/createServer.js
Outdated
app.use('/users', express.json(), usersRouter); | ||
app.use('/expenses', express.json(), expensesRouter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app.use('/users', express.json(), usersRouter); | |
app.use('/expenses', express.json(), expensesRouter); | |
app.use(express.json()); | |
app.use('/users', usersRouter); | |
app.use('/expenses', expensesRouter); |
You can apply to all routes at once
src/services/users.services.js
Outdated
// const getId = require('../utils/getMaxId'); | ||
|
||
// let users = []; | ||
|
||
// const initUsers = () => { | ||
// users = []; | ||
// }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments
src/utils/getMaxId.js
Outdated
function getCreateMaxId(array) { | ||
if (array.length === 0) { | ||
return 1; | ||
} else { | ||
const maxId = Math.max(...array.map((obj) => obj.id)); | ||
|
||
return maxId + 1; | ||
} | ||
} | ||
|
||
module.exports = { | ||
getCreateMaxId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove as you don't need it anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.