AspNetX
The AspNetX automatically generates help page content for the web APIs on your site.
Usage
AspNetX can be added to your in app in just a few simple steps:
- Add a dependency on the "AspNetX" package in
project.json
- Call
services.AddAspNetX
inConfigureServices
- Call
app.UseAspNetX
inConfigure
And when you browse to http://<yourApp>/api-docs, you should see Web APIs information in the web browser.
Customization
You can also custom the AspNetX with services.Configure<ServerOptions>
about you app and write a about.md in the IHostingEnvironment.ContentRoot
to generate the about page.
By default, AspNetX just collects the API Controller
annotated with RouteAttribute
or [ApiExplorerSettings(IgnoreApi = false)]
, and ignores others.
An example Startup.cs.
using AspNetX;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.Configure<ServerOptions>(o => o.Description = "无所谓好或不好,人生一场虚空大梦,韶华白首,不过转瞬。惟有天道恒在,往复循环,不曾更改…… —— 慕容紫英.仙剑奇侠传 4》");
services.AddAspNetX();
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseAspNetX();
app.UseMvc();
}
}
Features
-
Auto generate Web API description.
- Http method
- Relative path
- URL or query paramter
- Body parameter
- Request format and samples
- Response format and samples
- Model or entity metadata
-
Highlight http verbs.
For example, the
DELETE
method, we use the red color, andGET
with blue color. -
Auto load xml documentation description.
Set the
xmlDoc
astrue
to generate XML documentation from triple-slash comments in the source code.{ "buildOptions": { "xmlDoc": true } }
Support frameworks
- .NET framework 4.5.1
- .NET standard 1.6
Support platforms
- ASP.NET Core 1.0
- ASP.NET RC1
Other
You can get the latest release from the official Nuget.org feed or from its github releases page.
For ASP.NET DNX RC1 app, please get this version 1.0.2-rc1-final
from the offical Nuget.org or from its github releases page.