Thursday, 11 July 2019

What am I doing wrong? Why is the server not returning any cookies or responding with anything?

https://github.com/zMrKrabz/auth-engine/blob/master/src/user/controller.jsThat is my code. The /church domain returns correctly. However, when I try /register, there is no response? The function is suppose to send a jwt cookie on the client's browser.``` router.post('/register', (req, res) => { if (!req.body.username || req.body.password){ res.status(400).json({ success: false, error: "NO username or password" }); };userService.register(req) .then(({ token }) => { // sets a jwt token with the user info res.cookie('Information', token, { maxAge: 900000, httpOnly: true }); res.status(200).json({ success: true }); }) .catch(err => { res.status(400).json({ Error: err }) }) }); ```

Submitted July 12, 2019 at 06:24AM by HellD

No comments:

Post a Comment