I want to start an API from scratch and I am considering creating a definition with swagger to generate the api.
As explained overhere:
http://strongloop.com/strongblog/enterprise-api-swagger-2-0-loopback/Some questions arise though:
- "You can also use the pet model directly. It will provide you the full CRUD operations."
But it seems to me the more obvious interface would be the (v2) swagger api at /api.
Does this mean I should manually define all crud operations within the `paths` section of the swagger definition?
If so, it seems a bit like a step back, especially if I have to define these for a considerable amount of models.
- Within the `definitions` section in a swagger file all models can be defined.
Is there a way to indicate I want default CRUD methods to be generated for them at /api instead of the normal interface at /
(This is probably more of a swagger spec question and would solve the first question)
Downside being it lacks the extra stuff for authentication the normal generator adds (if I remember correctly)
I could use two endpoints / and /api, creating two kinds of services within angular, one with the crud operations and authentication and one for extra operations defined at /api, I hope though this is caused by my own misunderstanding of how to use the swagger generator and this is not necessary.
I'm not sure what the best approach is, using both, or define each and every crud method inside the swagger specification, any clues?