Giter Club home page Giter Club logo

api-gw-workshop's Introduction

API Gateway Workshop

Wellcome, workshop is a demonstration environment that puts together the necessary pieces to get you started with our API Gateway, using an example web application.

API gateway, we have added to the environment both the API (backend) that feeds the gateway and a website consuming the api gateway. Additionally, a dashboard with the metrics is also available so you can see your activity.

Services

The docker-compose starts the following services:

Web client

The consumer of the API gateway is a simple Express JS application that interacts with KrakenD to fetch the data. All code is under web/.

The client is a Single Page Application using Auth0 to generate JWT tokens.

You don't need to install any npm locally, the docker image will download and install the dependencies in the container for you.

Runs on http://localhost:3000

Backend

A simple API that provides raw data to the gateway.

You can add or remove data any time by adding XML, JSON or RSS files in the data folder.

Runs on http://localhost:8000

The designer

An instance of Krakendesigner (the GUI for manipulating the api-gw/krakend.json file.

You can drag the file api-gw/krakend.json anytime in the dashboard and resume the edition from there.

Runs on http://localhost:8787

The gateway!

An instance of KrakenD with several endpoints. Its configuration is in the folder api-gw/.

Runs on http://localhost:5001

Metrics

A Jaeger dashboard shows the traces of the activity you generate. Runs on http://localhost:16686

Prometheus

A Prometheus gathers the metrics from api gateway and stores them. Runs on http://localhost:9090

Grafana

Grafana is dashboarding UI, shows the metrics Runs on http://localhost:3333

RabbitMQ

Runs on http://localhost:15672

The JWT revoker

A simple implementation of a JWT rovoker using the KrakenD remote bloomfilter client.

Runs on http://localhost:9000

Start the service

Just:

docker-compose up

Development stuff

krakend-config2dot

Transalte your KrakenD config file into a dot graph go get github.com/devopsfaith/krakend-config2dot/cmd/krakend-config2dot

krakend-config2dot -c api-gw/krakend.json |dot -Tpng -o config.png

krakend-postman

go get -u github.com/devopsfaith/krakend-postman

Play!

Fire up your browser, curl, postman, httpie or anything else you like to interact with any of the published services.

Editing the API Gateway endpoints

To add or remove endpoints, edit the file api-gw/krakend.json. The easiest way to do it is by dragging this file to the KrakenD designer and download the edited file. To reflect the changes restart docker-compose.

The following endpoints are worth noticing:

  • /private/auth0: Protects and endpoint validating JWT tokens issued by Auth0
  • /private/custom: Protects and endpoint validating custom JWT tokens signed with /token.
  • /token: Signs a token
  • /public: Simple aggregation of two public API calls from Bitbucket and Github with some field selection.
  • /splash: Public endpoint aggregating data from the internal backend

lets generate some load!

k6 run loadtest/test.js

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.