fix api URLs refs

This commit is contained in:
chsakell
2016-10-16 10:22:03 +03:00
parent 577705e3c2
commit 6db505ed91
4 changed files with 8 additions and 6 deletions

View File

@@ -12,8 +12,6 @@ namespace LiveGameFeed.Core
{
private ILogger logger;
IMatchRepository _matchRepository;
private string _apiURI = "http://localhost:5000/api/";
public FeedEngine(IMatchRepository matchRepository,
ILogger<FeedEngine> logger)
{
@@ -51,7 +49,7 @@ namespace LiveGameFeed.Core
// Update Score for all clients
using (var client = new HttpClient())
{
await client.PutAsJsonAsync<MatchScore>(_apiURI + "matches/" + match.Id, score);
await client.PutAsJsonAsync<MatchScore>(Startup.API_URL + "matches/" + match.Id, score);
}
// Update Feed for subscribed only clients
@@ -64,7 +62,7 @@ namespace LiveGameFeed.Core
};
using (var client = new HttpClient())
{
await client.PostAsJsonAsync<FeedViewModel>(_apiURI + "feeds", _feed);
await client.PostAsJsonAsync<FeedViewModel>(Startup.API_URL + "feeds", _feed);
}
}
}

View File

@@ -17,6 +17,7 @@ namespace LiveGameFeed
{
public class Startup
{
public static string API_URL = string.Empty;
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
@@ -25,6 +26,8 @@ namespace LiveGameFeed
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
API_URL = Configuration["apiURL"];
}
public IConfigurationRoot Configuration { get; }

View File

@@ -6,7 +6,7 @@ export class ConfigService {
_apiURI : string;
constructor() {
this._apiURI = 'http://localhost:5000/api/';
this._apiURI = 'api/';
}
getApiURI() {

View File

@@ -6,5 +6,6 @@
"System": "Information",
"Microsoft": "Information"
}
}
},
"apiURL" : "http://localhost:5000/api/"
}