Start the app in dev mode
$ task build-dev
$ task run-dev
OR - Start the app in dev mode while watching files
$ task build-watch
$ task watch-dev
The API server will start using the PORT 5000
.
Step #1 - Install dependencies in virtualenv
$ pip install -r requirements.txt
Step #2 - setup flask
command for our app
$ export FLASK_APP=run.py
$ export FLASK_ENV=development
Or for Windows-based systems
$ (Windows CMD) set FLASK_APP=run.py
$ (Windows CMD) set FLASK_ENV=development
$
$ (Powershell) $env:FLASK_APP = ".\run.py"
$ (Powershell) $env:FLASK_ENV = "development"
Step #3 - start test APIs server at localhost:5000
$ flask run
Register -
api/users/register
(POST request)
POST api/users/register
Content-Type: application/json
{
"username":"test",
"password":"p@$$w0rd",
"email":"test@domain.io"
}
Login -
api/users/login
(POST request)
POST /api/users/login
Content-Type: application/json
{
"password":"p@$$w0rd",
"email":"test@domain.io"
}
Logout -
api/users/logout
(POST request)
POST api/users/logout
Content-Type: application/json
authorization: JWT_TOKEN (returned by Login request)
{
"token":"JWT_TOKEN"
}
Run tests using pytest tests.py