public PosIndexController(IPositivityIndexService positivityIndexService) { _positivityIndexService = positivityIndexService; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, INewsGetterService getnews, IPositivityIndexService getPosIndex) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } // 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", "GreatNews V1"); }); app.UseStaticFiles(); //app.UseHttpsRedirection(); app.UseCors("CORS_Policy"); app.UseAuthentication(); app.UseMvc(); //Hangfire app.UseHangfireServer(); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } }); RecurringJob.AddOrUpdate( () => getnews.AutoRefresh(), Cron.Hourly); RecurringJob.AddOrUpdate( () => getPosIndex.AddPsitiveIndexToNews(), Cron.Hourly(30)); }