I working on Angular application, where I am trying to server the build files from my Angular application through the dist directory in my express. To do this I copy the files generated by ng build and paste them into dist folder of express.
My dist folder looks like below
I am using the following code to serve the index.html file
this.app.use(express.static(__dirname + '/dist'))
But seem to be getting "Cannot GET /" error
Similarly if I do
this.app.use(express.static(__dirname + '/public'));
it serves the html in the public folder.
As far as my understanding, you can serve static from any folder in express. I am not sure if I am missing something here.
via RRP
No comments:
Post a Comment