Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RetroGamingContext context)
        {
            app.UseCors("CorsPolicy");

            app.UseOpenApi(config =>
            {
                config.DocumentName = "v1";
                config.Path         = "/openapi/v1.json";
            });
            app.UseOpenApi(config =>
            {
                config.DocumentName = "v2";
                config.Path         = "/openapi/v2.json";
            });

            app.UseSwaggerUi3(config =>
            {
                config.SwaggerRoutes.Add(new SwaggerUi3Route("v1", "/openapi/v1.json"));
                config.SwaggerRoutes.Add(new SwaggerUi3Route("v2", "/openapi/v2.json"));

                config.Path         = "/openapi";
                config.DocumentPath = "/openapi/v2.json";
            });

            if (env.IsDevelopment())
            {
                app.UseStatusCodePages();

                app.UseDeveloperExceptionPage();

                DbInitializer.Initialize(context).Wait();
            }

            app.UseRouting();

            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapGet("/", async context =>
            //    {
            //        await context.Response.WriteAsync("Hello World!");
            //    });
            //});

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 2
0
 public ScoresController(RetroGamingContext context, IMailService mailService)
 {
     this.context     = context;
     this.mailService = mailService;
 }
 public LeaderboardController(RetroGamingContext context)
 {
     this.context = context;
 }