21 lines
489 B
C#
21 lines
489 B
C#
#region snippet_1
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddGrpc().AddJsonTranscoding();
|
|
builder.Services.AddGrpcSwagger();
|
|
builder.Services.AddSwaggerGen(c =>
|
|
{
|
|
c.SwaggerDoc("v1",
|
|
new OpenApiInfo { Title = "gRPC transcoding", Version = "v1" });
|
|
});
|
|
|
|
var app = builder.Build();
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI(c =>
|
|
{
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
|
});
|
|
app.MapGrpcService<GreeterService>();
|
|
|
|
app.Run();
|
|
#endregion
|