-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Use minimal APIs for F# project templates #35833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8c84800
[WIP] Use minimal APIs (+remove Startup.fs) for F# project templates …
vzarytovskii d0876e0
Apply suggestions from code review
vzarytovskii b5a3c0e
[WIP] Added missing imports, added #nowarn \20\ since many builder me…
vzarytovskii 8b0d6b1
[WIP] Remove Startup.fs from webapi baselines + fix for webapi builder
vzarytovskii 0f275d2
Merge branch 'main' into fsharp-minimal-apis
vzarytovskii 61f99da
Added back explicit call to UseDeveloperExceptionPage if development …
vzarytovskii 3b3b245
Merge branch 'fsharp-minimal-apis' of https://github.com/vzarytovskii…
vzarytovskii 2d885f5
Merge branch 'main' into fsharp-minimal-apis
vzarytovskii 1aa7833
Use minimal APIs in the StarterWeb (mvc) template.
vzarytovskii 199f162
Removed Startup.fs
vzarytovskii 47cc513
Merge remote-tracking branch 'upstream/main' into fsharp-minimal-apis
vzarytovskii e321927
Merge remote-tracking branch 'upstream/main' into fsharp-minimal-apis
vzarytovskii 4d98bef
PR comments
vzarytovskii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
41 changes: 33 additions & 8 deletions
41
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Program.fs
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,52 @@ | ||
namespace Company.WebApplication1 | ||
|
||
#nowarn "20" | ||
open System | ||
open System.Collections.Generic | ||
open System.IO | ||
open System.Linq | ||
open System.Threading.Tasks | ||
open Microsoft.AspNetCore | ||
open Microsoft.AspNetCore.Builder | ||
open Microsoft.AspNetCore.Hosting | ||
#if (!NoHttps) | ||
open Microsoft.AspNetCore.HttpsPolicy; | ||
#endif | ||
open Microsoft.Extensions.Configuration | ||
open Microsoft.Extensions.DependencyInjection | ||
open Microsoft.Extensions.Hosting | ||
open Microsoft.Extensions.Logging | ||
|
||
module Program = | ||
let exitCode = 0 | ||
|
||
let CreateHostBuilder args = | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(fun webBuilder -> | ||
webBuilder.UseStartup<Startup>() |> ignore | ||
) | ||
|
||
[<EntryPoint>] | ||
let main args = | ||
CreateHostBuilder(args).Build().Run() | ||
let builder = WebApplication.CreateBuilder(args) | ||
|
||
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation() | ||
builder.Services.AddRazorPages() | ||
|
||
let app = builder.Build() | ||
|
||
if not(builder.Environment.IsDevelopment()) then | ||
app.UseExceptionHandler("/Home/Error") | ||
|
||
#if (!NoHttps) | ||
app.UseHsts() |> ignore // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
timheuer marked this conversation as resolved.
Show resolved
Hide resolved
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
app.UseHttpsRedirection() | ||
#endif | ||
|
||
app.UseStaticFiles() | ||
app.UseRouting() | ||
app.UseAuthorization() | ||
|
||
app.MapControllerRoute( | ||
name = "default", | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pattern = "{controller=Home}/{action=Index}/{id?}") | ||
|
||
app.MapRazorPages(); | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
app.Run() | ||
|
||
exitCode |
55 changes: 0 additions & 55 deletions
55
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Startup.fs
This file was deleted.
Oops, something went wrong.
28 changes: 20 additions & 8 deletions
28
src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Program.fs
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
namespace Company.WebApplication1 | ||
|
||
#nowarn "20" | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
open System | ||
open System.Collections.Generic | ||
open System.IO | ||
open System.Linq | ||
open System.Threading.Tasks | ||
open Microsoft.AspNetCore | ||
open Microsoft.AspNetCore.Builder | ||
open Microsoft.AspNetCore.Hosting | ||
#if (!NoHttps) | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
open Microsoft.AspNetCore.HttpsPolicy; | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#endif | ||
open Microsoft.Extensions.Configuration | ||
open Microsoft.Extensions.Hosting | ||
open Microsoft.Extensions.Logging | ||
|
||
module Program = | ||
let exitCode = 0 | ||
|
||
let CreateHostBuilder args = | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(fun webBuilder -> | ||
webBuilder.UseStartup<Startup>() |> ignore | ||
) | ||
|
||
[<EntryPoint>] | ||
let main args = | ||
CreateHostBuilder(args).Build().Run() | ||
|
||
let builder = WebApplication.CreateBuilder(args) | ||
|
||
builder.Services.AddControllers() | ||
|
||
let app = builder.Build() | ||
|
||
#if (!NoHttps) | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
app.UseHttpsRedirection() | ||
#endif | ||
|
||
app.UseAuthorization() | ||
vzarytovskii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
app.MapControllers() | ||
|
||
app.Run() | ||
|
||
exitCode |
42 changes: 0 additions & 42 deletions
42
src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-FSharp/Startup.fs
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.