Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swagger generated server

Overview

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.

Requirements

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.

Usage

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

Running with Docker

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

Example Request/Response

To generate more example curl commands, go to http://localhost:8080/forex/ui/ and click through the interface.

request:

curl -X GET --header 'Accept: application/json' 'http://localhost:8080/forex/get_ratUSD/CAD'

response:

{
  "date": "2018-12-17",
  "from_amt": 1.0,
  "from_iso": "USD",
  "to_amt": 1.3393,
  "to_iso": "CAD"
}

About

Forex api for use as microservice on kintohub.com

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.