Documenting RESTful APIs
Until now, we partially covered how RESTful web services APIs are described by wadl and documented by swagger specifications. Now it's time to take full advantage of them and expose their self-descriptive metadata in express.js routes in our catalog application. That way, both consumers and end users will have separate URLs for the metadata they will need to adopt the service easily. Let's start with the wadl definitions. Here's how an operation is fully described by wadl:
<resources base="http://localhost:8080/catalog/"> <resource path="/catalog/item/{itemId}"> <method name="GET"> <request> <param name="category" type="xsd:string" style="template"/> </request> <response status="200"> <representation mediaType="application/json" /> </response> <response status="404">...