using Microsoft.AspNetCore.Mvc; using MininalApi.Demo1; WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); WebApplication app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); #region 传递参数 app.MapGet("api/ParaInt",(int i)=>i); app.MapGet("api/ParaString",(string j) => { return j; }); app.MapGet("api/ParaIntString", (int i,string j) => i.ToString()+j); app.MapGet("api/ParaModel",([FromBody] Commodity commodity)=>commodity); app.MapGet("api/ParaList", ([FromBody] List<Commodity> list) => list); #endregion app.Run();