A simple API built in Flask/SQLAlchemy.
These are optional but recommended.
The default Git version is the master branch. ::
# clone the repository
$ cd desired/path/
$ git clone git@github.com:ericrommel/
The next step is install the project's Python dependencies. Just like Git if you still don't have it go to the official site and get it done. You'll also need Pip, same rules applies here. Another interesting tool that is not required but strongly recommended is Pipenv, it helps to manage dependencies and virtual environments.
Installing with Pip:
$ cd path/to/atados-project
$ pip install --upgrade flask flask-sqlalchemy # and any other optional packages
Installing with Pipenv:
$ pip install --upgrade pipenv
$ cd path/to/atados-project
$ pipenv sync -d
Finally, configure the application. This will require you to define a few variables and create the database.
Note: The pipenv virtual environment should be done.
Set the environment variables::
$ export FLASK_APP=src
$ export FLASK_ENV=development
Or on Windows cmd::
> set FLASK_APP=src
> set FLASK_ENV=development
Create the database::
$ flask db init
$ flask db migrate
$ flask db upgrade
Run the application::
$ flask run
Open http://127.0.0.1:5000 in a browser.
From Postman::
- Import the collection file: postman/
- Import the environment file: postman/
- Click on Runner button
- Select the collection imported
- Select the environment imported
- Click on Run button
From Python code tests (unit tests)::
$ pytest
Run with coverage report::
$ coverage run -m pytest
$ coverage report
$ coverage html # open htmlcov/index.html in a browser
This project is part of the Atados challenge.