I have an angular 4 app i am serving from node js
My server structure is as follows
.env
server.js
/admin //angular 4 app directory
index.html
....other angular files and assets folder
/modules
/config
...other files and folders at root level
server.js is my server file and i am attempting to serve the angular 4 app with the following code.
app.get('/admin', (req, res) => {
res.sendFile(path.join(__dirname, 'admin/index.html'));
});
So i should get the angular app at http://localhost:3020/admin
When i got to http://localhost:3020/admin i get the following error in the console
SyntaxError: expected expression, got '<'[Learn More]
inline.a808723d583c934ba8bf.bundle.js:1
SyntaxError: expected expression, got '<'[Learn More]
polyfills.5d1d5b016f19755a7d41.bundle.js:1
SyntaxError: expected expression, got '<'[Learn More]
main.036acd83ead6248588f0.bundle.js:1
When i click on any of the above links it indicates that the href of my angular app is
I noted that and i set it using https://angular.io/guide/deployment#!#fallback with the following command ng build --prod --base-href= "/admin/" and also ng build --prod --base-href= /admin/. but i keep getting the same error as above.
In my index.html the href is set to /admin/ i keep getting the same errors.
I have visited the following links but did not find anything about the error message i am getting.
ng serveto serve your website? - Jonathan Lamng build --prod -op=./admin/to build to the correct directory? - Jonathan Lam