2018-01-11 11:20:38 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2018-01-11 18:18:16 +01:00
|
|
|
|
using CacheManager.Core;
|
2018-01-11 11:20:38 +01:00
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2018-01-11 18:18:16 +01:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2018-01-11 11:20:38 +01:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2018-01-11 18:18:16 +01:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Ocelot.DependencyInjection;
|
|
|
|
|
using Ocelot.Middleware;
|
2018-01-11 11:20:38 +01:00
|
|
|
|
|
|
|
|
|
namespace OcelotApiGw
|
|
|
|
|
{
|
|
|
|
|
public class Startup
|
|
|
|
|
{
|
2018-01-11 18:18:16 +01:00
|
|
|
|
|
|
|
|
|
private readonly IConfiguration _cfg;
|
|
|
|
|
|
|
|
|
|
public Startup(IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
_cfg = configuration;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-11 11:20:38 +01:00
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
|
|
|
{
|
2018-01-11 18:18:16 +01:00
|
|
|
|
services.AddOcelot(_cfg);
|
2018-01-11 11:20:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
|
|
|
{
|
|
|
|
|
if (env.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
|
app.UseDeveloperExceptionPage();
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-11 18:18:16 +01:00
|
|
|
|
app.UseOcelot();
|
2018-01-11 11:20:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|