Giter VIP home page Giter VIP logo

aline-gateway's Introduction

Aline API Gateway

This server is a gateway that routes specific requests specified in the configurations to a microservice.

Starting Up The Server

The service does not require and special configurations to run for the first time. There is a dev profile available for immediate use with the current microservices that are available. Feel free to update that configuration as needed per your feature branch so that it may be merged when your microservice is ready for use.

Properties that are recommended to be set are the following:

app:
    gateway:
        service-host: http://localhost
        path-prefix: /api
        routes: # list of routes
        portal-origins: # list of front-end origins

Lets breakdown these properties:

  • app.gateway: This is the configuration property prefix.
  • service-host: This is the url of where the microservices will be hosted. The ports will be specified individually. Leave the service host uri without port definitions are other paths.
  • path-prefix: This is the prefix of the API to use. It could be /api or /api/v2. There should not be a trailing / at the end of the prefix.
  • routes: A list of routes that map to an added microservice.
  • portal-origins: A list of allowed front-end origins.

Adding Your Microservice

Adding your microservice is actually quite easy compared to previous orchestration methods this project has used.

The property app.gateway.routes holds a list of routes that specify the pattern of the incoming request as well as the uri of the service the request is being sent to.

It is recommended that yaml is used instead the default .properties file for this.

Find the routes property. The property should be nested within app.gateway:

app:
    gateway:
        routes: # List of routes

Under the routes property a list of route objects are stored.

A route object consists of the following properties:

    id: user # String name of your microservice
    port: 8070 # Port of the service (This is appended to a global property.
    paths:
        - @/users
        - @/users/{segment}
        - @/login
        - /login

Let's break down that schema.

  • id: The ID property is the name of your microservice. In this case, the ID is user for the 'user microservice.'
  • port: This property is appended to the global property serviceHost. It represents the port your service is running on.
  • paths: This is a string array of path patterns specified by the gateway.
    • Please see the patterns available in the Spring Cloud Gateway documentation.
    • An extra symbol that had been added was the @ symbol which is replaced by the global property path-prefix

aline-gateway's People

Contributors

beki01 avatar joshua-mallory avatar leandroyabut 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.