You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using QuickCHAT.Models;
|
|
|
|
namespace QuickCHAT
|
|
{
|
|
public class Startup
|
|
{
|
|
public IConfiguration Configuration { get; }
|
|
|
|
public Startup(IConfiguration configuration) {
|
|
Configuration = configuration;
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddMvc();
|
|
services.AddEntityFrameworkNpgsql()
|
|
.AddDbContext<DatabaseContext>(
|
|
options => options.UseNpgsql(Configuration.GetConnectionString("MainDatabase"))
|
|
)
|
|
.BuildServiceProvider();
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
} else {
|
|
app.UseHsts();
|
|
app.UseHttpsRedirection();
|
|
}
|
|
|
|
app.UseMvc();
|
|
}
|
|
}
|
|
}
|
|
|