https://github.com/christianrich/swagger-api-demo
Sample project featuring best practice of API building and testing
https://github.com/christianrich/swagger-api-demo
api ava node rest-api swagger-api swagger2
Last synced: 5 months ago
JSON representation
Sample project featuring best practice of API building and testing
- Host: GitHub
- URL: https://github.com/christianrich/swagger-api-demo
- Owner: ChristianRich
- Created: 2017-07-03T01:11:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-25T10:43:05.000Z (over 8 years ago)
- Last Synced: 2025-05-21T01:14:30.976Z (10 months ago)
- Topics: api, ava, node, rest-api, swagger-api, swagger2
- Language: JavaScript
- Size: 191 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swagger API demo
### Live demo (free account may take 10 seconds to load)
[https://swagger-tax-calc-api.herokuapp.com](https://swagger-tax-calc-api.herokuapp.com)
Sample project featuring best practice of API building and testing using [swagger.io](https://swagger/io)
For the purpose of demonstation this API calculates your personal income tax using 2016-17 ATO rates as per below table.
| Taxable income | Tax on this income |
|--------------------|--------------------------------------------|
| 0 – $18,200 | Nil |
| $18,201 – $37,000 | 19c for each $1 over $18,200 |
| $37,001 – $87,000 | $3,572 plus 32.5c for each $1 over $37,000 |
| $87,001 – $180,000 | $19,822 plus 37c for each $1 over $87,000 |
| $180,001 and over | $54,232 plus 45c for each $1 over $180,000 |
Calculation includes Medicare levy.
Source: [https://www.ato.gov.au/rates/individual-income-tax-rates/](https://www.ato.gov.au/rates/individual-income-tax-rates/)
### Install
`npm install`
### Run
`npm start`
### Run using Docker
`docker build -t tax .`
`docker run -it -p 8000:3000 -t tax`
App is now available at [http://localhost:8000](http://localhost:8000)
### Test
`npm test`
### Generate HTML code coverage report in /coverage directory
`npm run coverage`
### Swagger UI
When project is up and running you should see the Swagger UI live docs:
