adonis-api-docs
v0.2.7
Published
Automatic API documentation creator for AdonisJS
Downloads
15
Readme
Important
This package is being developed, it will be stable from version v1.0.0, come back in a few days :)
Adonis API Docs
Automatic API documentation creator for AdonisJS
Install
# with adonis install
$ adonis install adonis-api-docs
# or npm
$ npm i adonis-api-docs
# or yarn
$ yarn adonis-api-docs
Register Provider
// app/start.js
const providers = [
'adonis-api-docs/providers/AdonisApiDocsProvider'
]
Run
$ adonis serve --dev
If all is right, you will see the documentation API in
/docs
Requirements
Adonis API Docs uses the routes in app/routes.js
and the Route Validator rules to create automatic documentation. Your requests must be validated in this way
// app/router.js
Route.post('users', 'UserController.store').validator('StoreUser')
// app/Validators/StoreUser.js
class StoreUser {
get rules () {
return {
email: 'required|email|unique:users',
password: 'required'
}
}
}
module.exports = StoreUser
For more details read Route Validator or see this example