生产节点应用程序无法findSVG文件
在我的本地开发应用程序中,使用下面的代码(花括号embeddedAngular.jsvariables),svg文件显示得很好:
<img ng-src="img/servant_{{servant.personality}}.svg" draggable="false">
但是当部署在Heroku上时,SVG文件会产生一个404:
Failed to load resource: the server responded with a status of 404 (Not Found)
Angularvariables在生产站点上工作,图像地址是准确的。 所以,这不是问题。
相反,我认为我的Node / Express应用程序可能无法提供SVG文件。 也许这是一个Heroku问题? 仅供参考我正在使用MEAN堆栈。
这是我的公用文件夹的configuration:
//Setting the fav icon and static folder app.use(express.static(config.root + '/public'));
图像在
public/img
有什么想法吗?
确保你有正确的MIMEtypesconfiguration为服务SVG文件。 如果未设置所请求的文件types的MIME,某些服务器只会响应404。
图像/ SVG + xml的