Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Documented code #93

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/WebApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ namespace Codidact.Core.WebApp
{
public class Program
{
// Task Main makes an instance of
// HostBUilder and runs it asynchronously
public static async Task Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
await host.RunAsync();
}

// Create host builder creates a host builder for the website.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
Expand Down
9 changes: 8 additions & 1 deletion src/WebApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddInfrastructure(Configuration);

services.AddHttpContextAccessor();


// set up cookie service
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = "cookie";
Expand Down Expand Up @@ -74,6 +75,7 @@ public void ConfigureServices(IServiceCollection services)

JwtSecurityTokenHandler.DefaultMapInboundClaims = false;

// add services
services
.AddRazorPages()
.AddRazorRuntimeCompilation()
Expand Down Expand Up @@ -116,14 +118,19 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<
app.UseHsts();
}

// allow redirection
app.UseHttpsRedirection();

// allow static files
app.UseStaticFiles();

// allow routing
app.UseRouting();

// allow request localization
app.UseRequestLocalization();

// allow auth
app.UseAuthentication();
app.UseAuthorization();

Expand Down