Code Monkey home page Code Monkey logo

krakend-playground's Introduction

KrakenD Playground logo

KrakenD Playground

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

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

KrakenD Docker compose

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 krakend/krakend.json file.

You can drag the file krakend/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 krakend/.

Runs on http://localhost:8080

Metrics

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

The JWT revoker

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

Runs on http://localhost:9000

Start the service

Only if you want to try the Auth0 integration...

Create a new SPA application in Auth0 and fill the autogenerated values they give you under web/auth0-variables.js

var AUTH0_CLIENT_ID='AUTH0_CLIENT_ID';
var AUTH0_DOMAIN='AUTH0_DOMAIN';
var AUTH0_AUDIENCE = 'AUTH0_AUDIENCE';

This must be done before starting the docker-compose. If you have started docker-compose before setting these variables, you need to build the image again with docker-compose build web.

Start the service

Just:

docker-compose up

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 krakend/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.

To change the data in the static server (simulating your backend API) edit, add or delete files in the data/ folder.

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

Contribute!

This repository is the place for everyone to start using KrakenD. Maybe we are too used to KrakenD, and we don't realize what would be good to include here for a starter.

If it doesn't help you good enough or you think that you can add other demo endpoints or middleware integrations, please open a pull request!

Thanks!

krakend-playground's People

Contributors

byeblogs avatar

Watchers

 avatar

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.