I want to make it so that when someone visits www.xyz.com/frontend, they see my Angular app. I’m not sure how to set this up in my app.js file.
Has anyone done something similar before? What changes do I need to make in app.js to point to the right folder? Any tips or code snippets would be super helpful!
I have encountered a similar scenario in several projects. One effective approach is to use Node.js’s built-in ‘path’ module to create absolute paths for your static assets. In your app.js, for instance, you can do:
This configuration serves your Angular application from the designated ‘frontend’ folder. Additionally, to manage routing for a single-page application, you can add a catch-all route: