This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server.
This example uses the Connexion library on top of Flask.
Python 3.5.2+ Ensure the port you want to run on is defined in your environment as a variable named FOREX_PORT. Ensure the host url you want to run on is defined in your environment as a variable named FOREX_HOST.
To run the server, please execute the following from the root directory:
pip3 install -r requirements.txt
python3 -m swagger_server
and open your browser to here:
http://localhost:8080/forex/ui/
Your Swagger definition lives here:
http://localhost:8080/forex/swagger.json
To launch the integration tests, run pytest:
pytest
To run the server on a Docker container, please execute the following from the root directory:
# building the image
docker build --build-arg FOREX_PORT=$FOREX_PORT --build-arg FOREX_HOST=$FOREX_HOST -t forex_server ./
# starting up a container
docker run -p $FOREX_PORT:$FOREX_PORT forex_server
To generate more example curl commands, go to http://localhost:8080/forex/ui/ and click through the interface.
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/forex/get_ratUSD/CAD'
{
"date": "2018-12-17",
"from_amt": 1.0,
"from_iso": "USD",
"to_amt": 1.3393,
"to_iso": "CAD"
}