I'm creating a web site that makes calls to a WCF service that we host. Notice that the URL is hard-code in the JS:
var config = {
url: 'http://serverName:8000/MmaWebApiService/CreateCassette',
method: 'POST',
contentType: 'application/json; charset=utf-8',
data: { 'moduleSerialNumbers': 'dataHere' }
};
Where are we supposed to store URLs? I would think the web.config file would be a good spot, but I'm not sure how to access it. One suggestion is something like this:
<img id="ImgHeader" runat="server" src="<%$ ConfigurationSettings.AppSettings["ImagePath"] %>" />
However, I don't think that will work with my plain ol' HTML page, using AngularJS. I'm at a bit of a loss as to where to store service URLs so I don't have them hard-coded all over my JS. For example, if we deploy to a different server, I don't want to have to find all calls in JS and replace the server name. I must be missing a best practice.