You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
I've tested the code on the official website https://angular.io/guide/universal but the part of handling backend API does not work at all.
In fact, all requests to API paths fails (404 even when they are really here) even if they are described in the server.ts file.
To prove that, I've copied server.ts and removed all angular rendering and called it server.dev.ts, with only API routes (handled by expressjs only and no angular renderer) and if the universal app call the external server.dev.ts (which listen to another port and accepts CORS requests) it works.
Is there something I miss or there is nothing to be done on the v7 universal angular apps for API calls (or everything "non angular")?
I've downloaded the example on https://angular.io/guide/universal and even if the code states that api calls could be handled // TODO: implement data requests securely app.get('/api/*', (req, res) => { res.status(404).send('data requests are not supported'); });
In fact even if we change 404 to 200 it won't work, angular do not take into account custom route to expressjs.
Has anyone successfully implemented custom API routes with the current version of angular (as described in https://angular.io/guide/universal) ?
Thanks
The text was updated successfully, but these errors were encountered:
I thought I found a solution but there's none for the development environment. All /api/ calls are catch by the dev engine and there's no possibility to fully use only one project as it was before (I was able to use universal on my project in angular 5), except by launching an express server with the express routes in here... :(
Hi,
I've tested the code on the official website https://angular.io/guide/universal but the part of handling backend API does not work at all.
In fact, all requests to API paths fails (404 even when they are really here) even if they are described in the server.ts file.
To prove that, I've copied server.ts and removed all angular rendering and called it server.dev.ts, with only API routes (handled by expressjs only and no angular renderer) and if the universal app call the external server.dev.ts (which listen to another port and accepts CORS requests) it works.
Is there something I miss or there is nothing to be done on the v7 universal angular apps for API calls (or everything "non angular")?
I've downloaded the example on https://angular.io/guide/universal and even if the code states that api calls could be handled
// TODO: implement data requests securely app.get('/api/*', (req, res) => { res.status(404).send('data requests are not supported'); });
In fact even if we change 404 to 200 it won't work, angular do not take into account custom route to expressjs.
Has anyone successfully implemented custom API routes with the current version of angular (as described in https://angular.io/guide/universal) ?
Thanks
The text was updated successfully, but these errors were encountered: