ym@home node-js-jwt-auth-mongodb % node server.js
Server is running on port 8080.
Successfully connect to MongoDB.
SyntaxError: Unexpected token a in JSON at position 69
at JSON.parse ()
at parse (/Users/ym/NonDropBox/projects/bezkoder/node-js-jwt-auth-mongodb/node_modules/body-parser/lib/types/json.js:89:19)
at /Users/ym/NonDropBox/projects/bezkoder/node-js-jwt-auth-mongodb/node_modules/body-parser/lib/read.js:121:18
at invokeCallback (/Users/ym/NonDropBox/projects/bezkoder/node-js-jwt-auth-mongodb/node_modules/raw-body/index.js:224:16)
at done (/Users/ym/NonDropBox/projects/bezkoder/node-js-jwt-auth-mongodb/node_modules/raw-body/index.js:213:7)
at IncomingMessage.onEnd (/Users/ym/NonDropBox/projects/bezkoder/node-js-jwt-auth-mongodb/node_modules/raw-body/index.js:273:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21
I used your code in my project and I have rechecked the code a couple of times. It's working over http but I need it to work over https. Any solutions?
Error: Illegal arguments: undefined, string
at Object.bcrypt.hashSync (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/bcryptjs/dist/bcrypt.js:189:19)
at exports.signup (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/app/controllers/auth.controller.js:13:22)
at Layer.handle [as handle_request] (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/express/lib/router/layer.js:95:5)
at next (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/express/lib/router/route.js:137:13)
at checkRolesExisted (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/app/middlewares/verifySignUp.js:51:3)
at Layer.handle [as handle_request] (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/express/lib/router/layer.js:95:5)
at next (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/express/lib/router/route.js:137:13)
at User.findOne.exec (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/app/middlewares/verifySignUp.js:34:7)
at immediate (/home/labadmin/lab/node-js-jwt-auth-mongodb-master/node_modules/mongoose/lib/model.js:5065:18)
at process._tickCallback (internal/process/next_tick.js:61:11)
I forked your code and ran npm install. Im running into this issue: Error: Illegal arguments: undefined, string
(method:Post) localhost:8080/api/auth/signup
Error: Illegal arguments: undefined, string
at Object.bcrypt.hashSync (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/bcryptjs/dist/bcrypt.js:189:19)
at exports.signup (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/app/controllers/auth.controller.js:13:22)
at Layer.handle [as handle_request] (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/express/lib/router/route.js:137:13)
at checkRolesExisted (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/app/middlewares/verifySignUp.js:51:3)
at Layer.handle [as handle_request] (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/express/lib/router/route.js:137:13)
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/app/middlewares/verifySignUp.js:34:7
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/mongoose/lib/model.js:4915:16
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/mongoose/lib/model.js:4938:21
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/mongoose/lib/query.js:4380:11
at /Users/lordknighton/Desktop/node-js-jwt-auth-mongodb/node_modules/kareem/index.js:135:16
at processTicksAndRejections (internal/process/task_queues.js:79:11)