title: Static javascript app with server side configuration
body: <p>I'm building a vue app (using vue cli) with no server side rendering.</p>
  <p>However the app needs some configuration that cannot be hard-coded or generated at build time, the same build being deployed on many different environnement (QA, preprod, prod, etc.)</p>
  <p>I'm trying to find the better way to access configuration.</p>
  <p>I'm seeking for advice / ideas on how to achieve this.</p>
  <h3>Exemple of configuration data</h3>
  <ul>
  <li>The url to the backend api</li>
  <li>Configuration for authentification</li>
  </ul>
  <h3>Considerations</h3>
  <ul>
  <li>The app will be deployed on an Azure app service. Client and server parts have to be served from the same host.</li>
  <li>It should be possible to change configuration via Azure Portal (appSettings). This is how it works with almost every application we make, and we want our operation team to work the same way for each application.</li>
  <li>We <em>usually</em> write server-side code in C#. This is what our developpers know best, but I'm open to another solution.</li>
  <li>We would also use the server part to genereate <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP" rel="nofollow noreferrer">CSP</a> header</li>
  <li>The settings endpoint must be accessible from a known route under the same host, so I can request it without the need of any parameter, e.g. <code>GET /settings.json</code></li>
  </ul>
  <h3>Ideas I got so far</h3>
  <p><strong>Having a node.js server along the client code in the solution.</strong></p>
  <p>Pros :</p>
  <ul>
  <li>All is in the same solution, one build, one deploy.</li>
  </ul>
  <p>Cons :</p>
  <ul>
  <li>I'm not sure how to make the limitation clear and clean between the vue app (client side) and the server app.</li>
  <li>Not sure how to instruct webpack about this.</li>
  </ul>
  <p><strong>C# web app for serving configuration. I could bundle the client app under this website and deploy it.</strong></p>
  <p>Pros :</p>
  <ul>
  <li>Server side code and cliend-side code are clearly segregated</li>
  <li>We can the tech we now best for server side (C# in this case)</li>
  </ul>
  <p>Cons :</p>
  <ul>
  <li>Merging two project at build time seems kind of weird (although it is possible, I tried it)</li>
  </ul>