Last active
September 13, 2019 20:22
-
-
Save dileno/665d3027909c7a36f9c2cb76c352bab7 to your computer and use it in GitHub Desktop.
ConfigureServices method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | |
services.AddDbContext<BlogPostsContext>(options => | |
options.UseSqlServer(Configuration.GetConnectionString("BlogPostsContext"))); | |
services.AddCors(options => | |
{ | |
options.AddPolicy("CorsPolicy", | |
builder => builder.AllowAnyOrigin() | |
.AllowAnyMethod() | |
.AllowAnyHeader() | |
.AllowCredentials()); | |
}); | |
services.AddScoped(typeof(IDataRepository<>), typeof(DataRepository<>)); | |
// In production, the Angular files will be served from this directory | |
//services.AddSpaStaticFiles(configuration => | |
//{ | |
// configuration.RootPath = "ClientApp/dist"; | |
//}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment