Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ITrackingRepository trackingRepo, IConfiguration config)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var tConfig = app.ApplicationServices.GetRequiredService <TelemetryConfiguration>();

            tConfig.InstrumentationKey = config["ApplicationInsights:InstrumentationKey"];

            app.UseMvc();

            //Ensure Event Database exists
            trackingRepo.EnsureDatabase();


            ConfigureEventBus(app);

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Booking API");
            });
        }