Update templates to use endpoint routing (#4500)

This commit is contained in:
James Newton-King 2018-12-11 18:24:14 +13:00 committed by GitHub
parent c6fa808a91
commit 0c9eda1f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 18 deletions

View File

@ -25,9 +25,12 @@ namespace Company.WebApplication1
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
app.UseRouting(routes =>
{
await context.Response.WriteAsync("Hello World!");
routes.MapGet("/", async context =>
{
await context.Response.WriteAsync("Hello World!");
});
});
}
}

View File

@ -18,4 +18,6 @@ type Startup() =
if env.IsDevelopment() then
app.UseDeveloperExceptionPage() |> ignore
app.Run(fun context -> context.Response.WriteAsync("Hello World!")) |> ignore
app.UseRouting(fun routing ->
routing.MapGet("/", fun context -> context.Response.WriteAsync("Hello World!")) |> ignore
) |> ignore

View File

@ -155,13 +155,18 @@ namespace Company.WebApplication1
#endif
app.UseStaticFiles();
app.UseRouting(routes =>
{
routes.MapApplication();
});
app.UseCookiePolicy();
#if (OrganizationalAuth || IndividualAuth)
app.UseAuthentication();
#endif
app.UseMvc();
app.UseAuthorization();
}
}
}

View File

@ -154,18 +154,21 @@ namespace Company.WebApplication1
#endif
app.UseStaticFiles();
app.UseRouting(routes =>
{
routes.MapApplication();
routes.MapControllerRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseCookiePolicy();
#if (OrganizationalAuth || IndividualAuth)
app.UseAuthentication();
#endif
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseAuthorization();
}
}
}

View File

@ -40,10 +40,13 @@ type Startup private () =
#endif
app.UseStaticFiles() |> ignore
app.UseMvc(fun routes ->
routes.MapRoute(
app.UseRouting(fun routes ->
routes.MapApplication() |> ignore
routes.MapControllerRoute(
name = "default",
template = "{controller=Home}/{action=Index}/{id?}") |> ignore
) |> ignore
app.UseAuthorization() |> ignore
member val Configuration : IConfiguration = null with get, set

View File

@ -61,13 +61,17 @@ namespace Company.WebApplication1
}
app.UseHttpsRedirection();
#else
#endif
app.UseRouting(routes =>
{
routes.MapApplication();
});
#if (OrganizationalAuth || IndividualAuth)
app.UseAuthentication();
#endif
app.UseMvc();
app.UseAuthorization();
}
}
}

View File

@ -36,6 +36,10 @@ type Startup private () =
#else
#endif
app.UseMvc() |> ignore
app.UseRouting(fun routes ->
routes.MapApplication() |> ignore
) |> ignore
app.UseAuthorization() |> ignore
member val Configuration : IConfiguration = null with get, set