I want to create a simple registration form in ionic v3. But I’m getting this error;
POST http://localhost:8100/null 404 (Not Found)
ERROR Response {_body: “↵↵↵<meta char…dy>↵
Cannot POST /null↵↵↵”, status: 404, ok: false, statusText: “Not Found”, headers: Headers, …}
My code here;
auth.service.ts
signup(user_model:any):Observable<any>{
let url:"http://localhost:3000/user/signup";
let body = JSON.stringify(user_model);
let headers = new Headers({'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
console.log("body:",body);
return this.http.post(url, body, options)
.map((response: Response) => response.json());
}
signup.ts
signup(){
let loader = this.loaderCtrl.create({
content:"Please wait..."
})
loader.present();
console.log(this.user_model);
this.authService.signup(this.user_model).subscribe();
this.navCtrl.push(TabsPage);
loader.dismiss();
}
i am using node.js for backend.I tested it with postman and it works fine. Please help me thanks a lot…