Skip to content

Commit cd38f57

Browse files
committed
samples
1 parent bbf2ae1 commit cd38f57

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/samples/WebApiSample/WebApiSample/Startup.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@ public Startup(IConfiguration configuration)
2828
public void ConfigureServices(IServiceCollection services)
2929
{
3030
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
31-
32-
// Register the Swagger generator, defining 1 or more Swagger documents
33-
services.AddSwaggerGen(c =>
34-
{
35-
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
36-
});
37-
31+
3832
services.AddWorkflow(cfg =>
3933
{
4034
cfg.UseMongoDB(@"mongodb://mongo:27017", "workflow");
4135
cfg.UseElasticsearch(new ConnectionSettings(new Uri("http://elastic:9200")), "workflows");
4236
});
37+
38+
services.AddSwaggerGen(c => c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }));
4339
}
4440

4541
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
@@ -48,16 +44,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
4844
{
4945
app.UseDeveloperExceptionPage();
5046
}
51-
52-
// Enable middleware to serve generated Swagger as a JSON endpoint.
53-
app.UseSwagger();
54-
55-
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
56-
// specifying the Swagger JSON endpoint.
57-
app.UseSwaggerUI(c =>
58-
{
59-
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
60-
});
47+
48+
app.UseSwagger();
49+
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"));
6150

6251
app.UseMvc();
6352

0 commit comments

Comments
 (0)