Hi i got something peculiar on deployment.
I have a web app with ionic with angular 8, when I’m routing to / index in localhost works. But when i make ng build and deploy to the server, i got a error “cannot GET /index”.
Someone know what is happening here?
Thanks for your supporting.
Regards
It’s probably the server configuration. Are you using nginx, apache, firebase hosting, etc…?
Also, make sure there’s an index.html in your project output folder (www, public or whatever it’s set to). THere probably is but it doesn’t hurt to check.
Hi Joel! Thanks for your time. We are using express to serve the webapp. Heroku is our cloud service on deploy.
Regards
If express is serving it I would imagine it’s somewhere in the middleware but since it works on localhost maybe it’s a Heroku issue and the files are stored in a different location for prod?
// ---- SERVE STATIC FILES ---- //
app.server.get('*.*', express.static(APPPATH, {maxAge: '1y'}));
// ---- SERVE APLICATION PATHS ---- //
app.all('*', function (req, res) {
res.status(200).sendFile(`/`, {root: APPPATH});
});
1 Like
Thanks Joe, I implement the serve aplication paths with root: APPPATH and works like a charm.
Thanks for your help
1 Like