mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 09:17:47 +00:00
fix api URLs refs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -6,7 +6,7 @@ export class ConfigService {
|
||||
_apiURI : string;
|
||||
|
||||
constructor() {
|
||||
this._apiURI = 'http://localhost:5000/api/';
|
||||
this._apiURI = 'api/';
|
||||
}
|
||||
|
||||
getApiURI() {
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
},
|
||||
"apiURL" : "http://localhost:5000/api/"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user