简体   繁体   中英

error: "Error occured while trying to proxy to: localhost:4200/api/login" angular2 project

I was directed to use:

this.http.post('/api/login', this.employeeId).subscribe(res => { this.router.navigate(['/select']), (err) => {console.log(err)}}) 

as a way to get to the controller of my server router, which looks like this:

router.post('/login', home_controller.employee_login);

Is there a syntax error? or am I misunderstood on the routes somehow? source code: nodequiz project

You need to run two bashes terminal. The first terminal with "npm run server" and the second terminal with "npm start.

This work well for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM