using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.PlatformAbstractions;

namespace ObjectConfiguration_final {
    public class Startup {
        readonly IConfiguration Configuration;

        public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) {
            var builder = new ConfigurationBuilder();
            builder.SetBasePath(appEnv.ApplicationBasePath);
            builder.AddJsonFile("config.json");
            this.Configuration = builder.Build();
        }

        public void ConfigureServices(IServiceCollection services) {
            services.AddOptions();
            services.Configure<MyOptions>(this.Configuration);
            services.AddMvc();
        }

        public void Configure(IApplicationBuilder app) {
            app.UseIISPlatformHandler();
            app.UseDeveloperExceptionPage();
            app.UseMvc();
        }

    }
}
