Nuget

PM> Install-Package EndpointMvc.Mvc5
PM> Install-Package EndpointMvc.Mvc4
PM> Install-Package EndpointMvc.Mvc3

How it works

EndpointMvc uses attributes that you already apply to your MVC controller actions. It also uses a couple custom attributes to add more meta data to be used for the documentation. It then uses Reflection to gather the information needed to build the documentation. So all you have to do is write your code, EndpointMvc will build the documentation.
For a full example, see the Source Code for this very site on GitHub.

Register Routes

EndpointMvc needs to register its routes to handle the calls

You can register the routes via the Extension methods.
You can register the routes via EndpointMvc RouteConfig class.
If you want to be able to call EndpointMvc on specific areas, then you need to register before any area is registered.
There are some specific css files and javascript files that are needed to make everything work correctly. Here is how you register those.

Output

EndpointMvc has the following output formats:

Each of the output formats have an action, with html being the default.

Your action calls should look like the following:

~/endpoints/{format}/

Html

Views are defined for rendering documentation as HTML. These views live in ~/Views/Endpoints/
  • Html.cshtml
    This view is the main rendering page for the documentation.
    This view expects the _Layout.cshtml to render 2 specific sections; scripts & styles. These are the areas in which the scripts and styles are registered. Also, the navigation is rendered in the scripts section.
  • Define.cshtml
    This view is used for rendering information about a specific type.
    This view expects the _Layout.cshtml to render 2 specific sections; scripts & styles. These are the areas in which the scripts and styles are registered. Also, the navigation is rendered in the scripts section.
  • Shared/_EndpointNavigation.cshtml
    This is the navigation bar view.

Attributes

Attribute information to add rich meta data to your controller actions.
  • EndpointAttribute - ( Class )

    This indicates that a class is an endpoint. All public actions in the controller will then be defined as endpoint actions, unless they are flagged with the IgnoreAttribute or the NonActionAttribute.
  • IgnoreAttribute - ( Class | Method | Parameter | Property )

    Ignores a class, method, parameter, or property when building output.
    Note: Overloaded methods are supported, but they MUST have different HTTP verb signatures.
  • DeprecatedAttribute - ( Class | Method )

    Marks a class or method as deprecated and includes the specified reason.
  • RequiresAuthenticationAttribute - ( Class | Method )

    Note: This attribute is not a filter and does not do any checks to see if the user is authenticated. You should use another attribute/filter to perform those checks.
  • SampleValueAttribute - ( Parameter )

    Defines a value that will be used to construct a sample execution url.
  • CustomPropertyAttribute - ( Class | Method | Parameter | Property )

    Adds custom meta data to the class, method, parameter, or property. You can add multiple attributes to individual elements.
    Note: Custom properties that are added to a class are merged with properties added to a method. If a method has one with the same key, the method property overrides the class level property.
  • SinceVersionAttribute - ( Class | Method )

    Indicates that the specified class or method has been available since the specified version.
  • ReturnTypeAttribute - ( Method )

    Mainly for methods that return ActionResult. This allows you to specify the actual type that is returned.
    Note: If the return type is not ActionResult, that return type will be used. If you add this, it will override that type.
    Note: If the attribute is not added to an ActionResult, the return type of that method will be described as an Object.
  • ContentTypeAttribute - ( Method )

    Allows you to described the content type that is returned. You can add multiple attributes to a method.
  • GistAttribute - ( Class | Method )

    Allows code examples to be added to the documentation. This uses Gists by GitHub.
    Note: Multiple Gist Attributes can be added to an element.
  • AuthorizeAttribute - ( Class | Method )

    Indicates that a class or method requires the request to be authenticated before accessing the endpoint.
  • ObsoleteAttribute - ( Class | Method )

    Marks a class or method as obsolete and includes the specified reason.
  • DescriptionAttribute - ( Class | Method | Parameter | Property )

    Describes the class, method, property, or parameter.
  • RequiredAttribute - ( Parameter )

    Indicates that the parameter must have a value passed to the request.
    If the parameter is a non-nullable type, that does not have a default value set, this it will automatically be marked as required.
  • OptionalAttribute - ( Parameter )

    Can be used instead of the required attribute.
    If the parameter is a non-nullable type, that does not have a default value set, this it will automatically be marked as required.
  • AcceptsVerbsAttribute - ( Method )

    This is used on the action methods to tell MVC what HTTP methods are accepted.
    You can use the HTTP Method specific attributes as well, like HttpGetAttribute, HttpPostAttribute, etc.
  • RequireHttpsAttribute - ( Class | Method )

    Indicates if the request requires SSL.

License