Skip to content
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

Add vb webapi templates #153

Merged
merged 1 commit into from
May 25, 2022
Merged
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
21 changes: 21 additions & 0 deletions Templates/webapi/Program.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
' This application entry point is based on ASP.NET Core new project templates and is included
' as a starting point for app host configuration.
' This file may need updated according to the specific scenario of the application being upgraded.
' For more information on ASP.NET Core hosting, see https://docs.microsoft.com/aspnet/core/fundamentals/host/web-host

Imports Microsoft.AspNetCore.Hosting
Imports Microsoft.Extensions.Hosting

Public Module Program
Public Sub Main(args As String())
CreateHostBuilder(args).Build().Run()
End Sub

Public Function CreateHostBuilder(args As String()) As IHostBuilder
Return Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(
Sub(webBuilder)
webBuilder.UseStartup(Of Startup)()
End Sub
)
End Function
End Module
41 changes: 41 additions & 0 deletions Templates/webapi/Startup.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
' This Startup file Is based on ASP.NET Core New project templates And Is included
' as a starting point for DI registration And HTTP request processing pipeline configuration.
' This file will need updated according to the specific scenario of the application being upgraded.
' For more information on ASP.NET Core startup files, see https://docs.microsoft.com/aspnet/core/fundamentals/startup

Imports Microsoft.AspNetCore.Builder
Imports Microsoft.AspNetCore.Hosting
Imports Microsoft.Extensions.Configuration
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Hosting

Public Class Startup
Public Sub New(configuration As IConfiguration)
Me.Configuration = configuration
End Sub

Public ReadOnly Property Configuration As IConfiguration

' This method gets called by the runtime. Use this method to add services to the container.
Public Sub ConfigureServices(services As IServiceCollection)
services.AddControllers()
End Sub

' This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Public Sub Configure(app As IApplicationBuilder, env As IWebHostEnvironment)

If (env.IsDevelopment()) Then
app.UseDeveloperExceptionPage()
End If

app.UseFileServer()
app.UseRouting()
app.UseAuthorization()

app.UseEndpoints(
Sub(routes)
routes.MapControllers()
End Sub)

End Sub
End Class