-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathStartup.vb
45 lines (36 loc) · 1.67 KB
/
Startup.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Imports Microsoft.AspNetCore.Builder
Imports Microsoft.AspNetCore.Hosting
Imports Microsoft.Extensions.Configuration
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Hosting
Imports Microsoft.OpenApi.Models
Namespace WhatsappChatbotVB
Public Class Startup
Public Sub New(ByVal 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(ByVal services As IServiceCollection)
services.AddControllers()
services.AddSwaggerGen(Sub(c) c.SwaggerDoc("v1", New OpenApiInfo With {
.Title = "WhatsappChatbotVB",
.Version = "v1"
}))
services.AddTransient(Of ChatService)()
services.Configure(Of AppSettings)(Configuration.GetSection("AppSettings"))
End Sub
' This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Public Sub Configure(ByVal app As IApplicationBuilder, ByVal env As IWebHostEnvironment)
If env.IsDevelopment() Then
app.UseDeveloperExceptionPage()
app.UseSwagger()
app.UseSwaggerUI(Sub(c) c.SwaggerEndpoint("/swagger/v1/swagger.json", "WhatsappChatbotVB v1"))
End If
app.UseHttpsRedirection()
app.UseRouting()
app.UseAuthorization()
app.UseEndpoints(Sub(endpoints) endpoints.MapControllers())
End Sub
End Class
End Namespace