问题
I have create a MEAN Stack Application (Angular 6). Now I want to convert my application into Desktop Application with the same. we can achieve that in electron so that i read this Article. by using this Article I have created my application. but I am not get request from the application to server(node.js).
here is my angular req:
postlogindata(body: any): Observable<any> {
return this._http.post(`http://192.168.1.174:8085/login`, body, {
observe:'body',
withCredentials :true,
headers:new HttpHeaders().append('Content-Type','application/json')
});
}
here I'm receiving the request in Node server.js
page
app.post('/login', UserConfig.loginVerify);
cors origin config
app.use(cors({
origin: ['http://localhost:4200','http://localhost:8085','http://192.168.1.174:8085', 'http://127.0.0.1:4200'],
credentials: true
}));
in web application I didn't get any error. but in desktop application i'm getting this error in my console. I have read many articles i didn't get any answer.
can anyone explain to me how to resolve this?
来源:https://stackoverflow.com/questions/54108769/angular-electron-with-nodejs-using-mean-stack