Code Monkey home page Code Monkey logo

rgate's Introduction

RGate

API Gateway for Python to link to docker containers based on a backend config.

Installation

Requirements

  • python 3.8
  • pip

Using virtualenv

From the repository root:

virtualenv ./env
source ./env/bin/activate
pip install -U -r requirements.txt

Activate your virtualenv, then use python from the env to launch the application as described below.

Usage

Setting up dummy backends

This repo comes pre-configured with two backends, orchestrated by docker-compose.

You'll need to start off with docker-compose build, then follow with docker-compose up. This sets up necessary labels and port mapping.

Running RGate

See python rgate.py --help, or:

python rgate.py --port 8080 --config ./cfg.yaml

Note: RGate will fail at startup if there are no containers to serve a backend. The error should be clear. If a container fails after start-up, requests to that backend will receive a 503.

Testing it out

curl localhost:8080/api/payments
curl localhost:8080/api/payments/some_path
curl localhost:8080/api/orders/

rgate's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.