Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular app unable to find asset files on Azure

Tags:

angular

azure

I've just deployed my angular app to azure by running an ng build --prod and pushing it to git but I get a 404 error saying that it cannot find my json file I have in the assets folder.

I've also tried running ng build --prod --base-href "./" but I'm till getting the same error.

I'm currently trying to get the files in an api service like this:

return this.http.get('../assets/exercises.json')

but when I run the website on azure I get a 404 error Failed to load resource: the server responded with a status of 404 (Not Found)

like image 782
Mike Avatar asked May 20 '19 02:05

Mike


1 Answers

You need to add your own web.config.Its in the documentation of Angular: https://angular.io/guide/deployment

<staticContent><mimeMap fileExtension=".json" mimeType="application/json" /></staticContent>
like image 138
Sajeetharan Avatar answered Oct 25 '22 11:10

Sajeetharan