diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-18 16:40:24 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-18 16:40:24 +0000 |
commit | e91a06475da796ee2393af174ee31c702a2c8966 (patch) | |
tree | 3a12311af9f7b2afbd8a036a5d38601ca4483fb6 /Server/Startup.cs | |
parent | 2b42bf3dfada947d3ef73c1d292f4bc1da7bcb00 (diff) | |
parent | c94ca254d8ed2a4f29f49f5de0a8e542c73230b7 (diff) | |
download | newsaggregator-e91a06475da796ee2393af174ee31c702a2c8966.tar.gz newsaggregator-e91a06475da796ee2393af174ee31c702a2c8966.tar.bz2 newsaggregator-e91a06475da796ee2393af174ee31c702a2c8966.zip |
Changed merge
Diffstat (limited to 'Server/Startup.cs')
-rw-r--r-- | Server/Startup.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Server/Startup.cs b/Server/Startup.cs new file mode 100644 index 0000000..93bae2d --- /dev/null +++ b/Server/Startup.cs @@ -0,0 +1,48 @@ +using System;
+using System.Collections.Generic;
+
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+using Classes;
+using Database;
+using Aggregator.Parser;
+
+namespace Server {
+ public class Startup {
+ public Startup(IConfiguration configuration) {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ public void ConfigureServices(IServiceCollection services) {
+ services.Configure<CookiePolicyOptions>(options => {
+ options.CheckConsentNeeded = context => true;
+ options.MinimumSameSitePolicy = SameSiteMode.None;
+ });
+
+ services.AddDbContext<DatabaseContext>(options => {
+ options.UseMySQL(Configuration.GetConnectionString("connectionString"));
+ });
+ }
+
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
+ if (env.IsDevelopment()) {
+ app.UseDeveloperExceptionPage();
+ }
+ else {
+ app.UseExceptionHandler("/Error");
+ app.UseHsts();
+ }
+
+ app.UseDefaultFiles();
+ app.UseStaticFiles();
+ }
+ }
+}
|