Request Body undefined

// Component: passwordRest(){ this.userService.passwordReset(this.email) } // Service: passwordReset(email){ return this._http.post('/api/passwordreset/', email).subscribe(); } // BACKEND: app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(function(req, res, next) { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); res.setHeader('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS'); next(); }); router.post('/passwordreset', function(request,response){ console.log(request.body) })
This is the only route that is not working. I have tried a bunch of things and it does not seem to work, any help would be great.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.