-
Notifications
You must be signed in to change notification settings - Fork 7
/
Startup.cs
37 lines (32 loc) · 1.28 KB
/
Startup.cs
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
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using SimpleEndpoints.Extensions;
namespace SimpleEndpoints.Example
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers(options =>
{
//Register simple endpoints & configure global route and naming convention
options.WithSimpleEndpoints(endpointsConfiguration =>
endpointsConfiguration
.WithRoutePrefix("api")
.WithEndpointNamingConvention("Endpoint"));
});
//This is just so we can use Swagger and could be named accordingly
services.AddSimpleEndpointRouting();
services.AddSwaggerGen(options =>
options.SwaggerDoc("v1", new OpenApiInfo {Title = "Simple endpoints", Version = "v1"}));
}
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(options => options.MapControllers());
app.UseSwagger();
app.UseSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", "Simple endpoints V1"));
}
}
}