-
Notifications
You must be signed in to change notification settings - Fork 0
worked on question2 #7
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
base: new_branch3
Are you sure you want to change the base?
Conversation
| const bcrypt = require("bcryptjs"); | ||
| const jwt = require("jsonwebtoken"); | ||
| const {updateuser1,getdata,matchpass,modifyPass,verifyemail,userlogin,usersignup,user_list} = require("../services/userservices") | ||
| const {updateuser1,getdata,useraddress,matchpass,modifyPass,verifyemail,userlogin,usersignup,user_list} = require("../services/userservices") |
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.
use classes or object and keep everything inside it a lot of import like this doesn't look good
| const userModel = require("./userModel"); | ||
| const user = mongoose.Schema({ | ||
| user_id:{ | ||
| type:'ObjectId', |
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.
createdat and updated At field should be there
| router.use('/updateuser',mid_register.checkAuth) | ||
| router.use('/get',mid_register.checkAuth) | ||
| router.use('/delete',mid_register.checkAuth) | ||
| router.use('/address',mid_register.checkAuth) |
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.
move middleware in separate file instead route
| pin_code: data.pin_code, | ||
| phone: data.phone | ||
| }); | ||
| if(user){ |
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.
why are you checking user here ? you need to verify data
|
|
||
| exports.checkAuth = async (req, res, next) => { | ||
| const bearerHeader = req.headers["authorization"]; | ||
| if (typeof bearerHeader !== "undefined") { |
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.
improve else if conditions here doesn't look good here
No description provided.