Ejemplo 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, IPeriodicCanvasJobs PeriodicCanvasJobs)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseSwagger();

            app.UseSwaggerUI(x =>
            {
                x.SwaggerEndpoint("/swagger/v1/swagger.json", "My first API");
                //x.RoutePrefix = string.Empty; // launch swagger from root
            });

            app.UseCors(MyAllowSpecificOrigins);

            app.UseHangfireDashboard();

            RecurringJob.AddOrUpdate("1",
                                     () => PeriodicCanvasJobs.CreateNewCanvas(), "0 0 * * *",
                                     TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time"));

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IPeriodicCanvasJobs periodicCanvasJobs)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseSwagger();

            app.UseSwaggerUI(x =>
            {
                x.SwaggerEndpoint("/swagger/v1/swagger.json", "My Api");
            });

            app.UseHangfireDashboard();
            RecurringJob.AddOrUpdate("some-id", () => periodicCanvasJobs.CreateNewCanvas(), "0 0 * * *", TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time"));

            app.UseRouting();

            app.UseCors(builder => {
                builder.WithOrigins(Configuration["AllowedOrigins"].Split(";"))
                .AllowAnyHeader()
                .AllowAnyMethod()
                .AllowCredentials();
            });

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHub <SignalRHub>("/hub");
            });
        }