A microservice which can support an expense tracking application.
Get the source code
$ git clone https://github.com/anshajkhare/expense-tracker-microservice.git
$ cd expense-tracker-microservice
Setup Virtual Environment:
$ python3 -m venv .venv
$ source ./.venv/bin/activate
$ pip install --upgrade pip
$ pip3 install -r requirements.txt
To run tests, run the following command
$ python -m unittest discover tests -p '*_test.py'
Code Coverage:
$ coverage run --source=expense_service --branch -m unittest discover tests -p '*_test.py'
After running tests with code coverage, you can get the report
$ coverage report
Name Stmts Miss Branch BrPart Cover
-----------------------------------------------------------------------
expense_service/__init__.py 2 0 0 0 100%
expense_service/service.py 23 1 0 0 96%
expense_service/tornado/__init__.py 0 0 0 0 100%
expense_service/tornado/app.py 83 4 8 3 92%
expense_service/tornado/server.py 41 41 2 0 0%
-----------------------------------------------------------------------
TOTAL 149 46 10 3 68%
Static Type Checker
$ mypy ./expense_service ./tests
Linter
$ flake8 ./expense_service ./tests
GET /v1/expenses
GET /v1/expenses/{id}
Parameter | Type | Description |
---|---|---|
id |
string |
[Required] ID of expense to be fetched |
POST /v1/expenses
PUT /v1/expenses/{id}
Parameter | Type | Description |
---|---|---|
id |
string |
[Required] ID of expense to be updated |
DELETE /v1/expenses/{id}
Parameter | Type | Description |
---|---|---|
id |
string |
[Required] ID of expense to be deleted |