Last active
October 23, 2023 13:09
-
-
Save dj-nitehawk/5d5d325e23c4be43aeccbcb0066a72b4 to your computer and use it in GitHub Desktop.
Using old style app host-builder with `Startup.cs`
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 class Program | |
{ | |
public static void Main(string[] args) | |
=> CreateHostBuilder(args).Build().Run(); | |
public static IHostBuilder CreateHostBuilder(string[] args) | |
=> Host.CreateDefaultBuilder(args) | |
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>()); | |
} |
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 class Startup | |
{ | |
public IConfiguration Configuration { get; } | |
public Startup(IConfiguration configuration) { Configuration = configuration; } | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddFastEndpoints() | |
.SwaggerDocument(); | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
app.UseRouting() | |
.UseEndpoints(x => x.MapFastEndpoints()) | |
.UseSwaggerGen(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment