Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create web config file in angular 5 project?

Tags:

angular

I have created an angular 5 web site, with Webform or MVC I want to deploy to customers, I just want to change some variables (dbconnection, name, ...) in the webconfig file, but with angular I don't know how to do it. So every time I deploy, I have to build again, so is there a way to solve this problem?

like image 298
jimbo R Avatar asked Oct 17 '22 18:10

jimbo R


1 Answers

try to add this as web.config file with dist folder


<?xml version="1.0" encoding="utf-8"?>
<configuration>

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Angular Routes" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="./index.html" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

</configuration>

for more i recommend reading this article: https://medium.com/angular-in-depth/deploy-an-angular-application-to-iis-60a0897742e7

like image 95
Muhammed Moussa Avatar answered Oct 21 '22 08:10

Muhammed Moussa