-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial work on webhosting * initial work on webhosting
- Loading branch information
1 parent
8b76844
commit 57c8905
Showing
30 changed files
with
289 additions
and
205 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,66 @@ | ||
using Microsoft.Extensions.DependencyModel; | ||
using Rocket.Surgery.Conventions; | ||
using Rocket.Surgery.Hosting; | ||
using System.Reflection; | ||
using Hellang.Middleware.ProblemDetails; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.OpenApi.Models; | ||
using Rocket.Surgery.LaunchPad.AspNetCore; | ||
using Rocket.Surgery.LaunchPad.AspNetCore.AppMetrics; | ||
using Rocket.Surgery.Web.Hosting; | ||
using Sample.Restful; | ||
using Serilog; | ||
using Swashbuckle.AspNetCore.SwaggerGen; | ||
|
||
namespace Sample.Restful; | ||
var builder = WebApplication.CreateBuilder(args) | ||
.ConfigureRocketSurgery(Imports.GetConventions); | ||
|
||
[ImportConventions] | ||
public static partial class Program | ||
{ | ||
public static void Main(string[] args) | ||
builder.Services.AddControllers().AddControllersAsServices(); | ||
builder.Services | ||
.Configure<SwaggerGenOptions>( | ||
c => c.SwaggerDoc( | ||
"v1", | ||
new OpenApiInfo | ||
{ | ||
Version = typeof(Program).GetCustomAttribute<AssemblyVersionAttribute>()?.Version | ||
?? typeof(Program).GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? "0.1.0", | ||
Title = "Test Application", | ||
} | ||
) | ||
); | ||
|
||
var app = builder.Build(); | ||
app.UseProblemDetails(); | ||
app.UseHttpsRedirection(); | ||
|
||
// Should this move into an extension method? | ||
app.UseSerilogRequestLogging( | ||
x => | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
x.GetLevel = LaunchPadLogHelpers.DefaultGetLevel; | ||
x.EnrichDiagnosticContext = LaunchPadLogHelpers.DefaultEnrichDiagnosticContext; | ||
} | ||
); | ||
app.UseMetricsAllMiddleware(); | ||
|
||
app.UseRouting(); | ||
|
||
app | ||
.UseSwaggerUI() | ||
.UseReDoc(); | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) | ||
app.UseAuthorization(); | ||
|
||
app.UseEndpoints( | ||
endpoints => | ||
{ | ||
return Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>()) | ||
.LaunchWith(RocketBooster.ForDependencyContext(DependencyContext.Default), z => z.WithConventionsFrom(GetConventions)); | ||
endpoints.MapControllers(); | ||
|
||
// Should this move into an extension method? | ||
endpoints.MapSwagger(); | ||
endpoints.MapAppMetrics(); | ||
} | ||
); | ||
app.Run(); | ||
|
||
public partial class Program | ||
{ | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.