-
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
add task solution #272
base: master
Are you sure you want to change the base?
add task solution #272
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.
Great job.
Check some small minor comments about using constants.
Many thanks)
const expensesController = require('../constrollers/expenses.controller.js'); | ||
const expensesRouter = express.Router(); | ||
|
||
expensesRouter.get('/', expensesController.getAllExpenses); |
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.
You can move all routes to constants
const userController = require('../constrollers/users.controller.js'); | ||
const usersRouter = express.Router(); | ||
|
||
usersRouter.get('/', userController.getAllUsers); |
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.
The same, you can add routes to constants
|
||
app.use(cors()); | ||
|
||
app.use('/users', express.json(), usersRouter); |
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.
Also can move to constants
|
||
res.json(updatedUser); | ||
} catch (error) { | ||
res.status(500).json({ error: 'Internal server error' }); |
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.
All messages and status code need to move in constants
add task solution