Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadarif-lab authored Jan 7, 2019
2 parents e44cc33 + b735371 commit 210a881
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ adonis install adonis-swagger
]
```

* Other configuration please update the `config/swagger.js` file.
* **Note:** For projects that uses API-only blueprint (using `--api-only` flag), please
enable `Adonis/Middleware/Static` under `serverMiddleware` in `start/kernel.js`:
```js
const serverMiddleware = [
'Adonis/Middleware/Static',
...
]
```

* For other configuration, please update the `config/swagger.js`.

# Sample Usage
* Add new route
* Add new route:
```js
Route.get('/api/hello', 'TestController.hello')
```

* Create TestController using command adonis make:controller Test
* Create `TestController` using `adonis make:controller Test` command:
```js
'use strict'

Expand Down Expand Up @@ -63,7 +72,7 @@ adonis install adonis-swagger
module.exports = TestController
```

* You can also define the schema in the Models
* You can also define the schema in the Models:
```js
'use strict'

Expand Down Expand Up @@ -108,11 +117,10 @@ adonis install adonis-swagger
│ ├── **/*.yml
```

* Other sample in YAML and JS format please refer this [link](/sample)

* For other sample in YAML and JS format, please refer to this [link](/sample).

Open http://localhost:3333/docs in your browser, ayeey 🎉 </br>
For detail usage, please check the swagger specification in this [link][SwaggerSpec].
Open http://localhost:3333/docs in your browser, ayeey 🎉
For detail usage, please check the Swagger specification in this [link][SwaggerSpec].

# Command List
Command | Description
Expand Down
34 changes: 23 additions & 11 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Registering provider
```js
const providers = [
...
'adonis-swagger/providers/SwaggerProvider'
]
```
# Configuration
* Register `SwaggerProvider` in `start/app.js`:
```js
const providers = [
...
'adonis-swagger/providers/SwaggerProvider'
]
```

* **Note:** For projects that uses API-only blueprint (using `--api-only` flag), please
enable `Adonis/Middleware/Static` under `serverMiddleware` in `start/kernel.js`:
```js
const serverMiddleware = [
'Adonis/Middleware/Static',
...
]
```

* For other configuration, please update the `config/swagger.js`.

# Usage
* Add new route
* Add new route:
```js
Route.get('/api/hello', 'TestController.hello')
```

* Create TestController using command adonis make:controller Test
* Create `TestController` using `adonis make:controller Test` command:
```js
'use strict'

Expand Down Expand Up @@ -46,7 +58,7 @@ const providers = [
module.exports = TestController
```

* You can also define the schema in the Models
* You can also define the schema in the Models:
```js
'use strict'

Expand Down Expand Up @@ -93,4 +105,4 @@ const providers = [

> For custom directory, please change the `config/swagger.js` as needed.
* Other sample in YAML and JS format please refer this [link](https://github.com/ahmadarif/adonis-swagger/tree/master/sample)
* For other sample in YAML and JS format, please refer to this [link](https://github.com/ahmadarif/adonis-swagger/tree/master/sample)

0 comments on commit 210a881

Please sign in to comment.