Giter Site home page Giter Site logo

api-gateway's Introduction

API Gateway

Overview

The API Gateway aims to provide a single access point to the three components of Agape Approach: the API Syntactic Extractor, the API Dataset Generator, and the API Syntactic Similarity Analyzer. It transparently routes and manages all request traffic to specific destination components that hold the respective information.

By registering these components, the API Gateway can collate information from the schema of each component, as well as the endpoints to obtain information wherever they reside. As a result, it possesses a comprehensive super schema that encompasses all functionalities available in the registered components. Figure 1 shows the registration of that three (3) microservices.

API Gateway Diagram

Figure 1: Example of the API Gateway registering the components in parallel.

Implementation Details

Constructed using JavaScript, the API Gateway is a lightweight, dynamic, and web-compatible solution. The choice of language complements the ASE algorithm's versatility and caters to the overarching requirements of the System of Systems context, as described within the Agape approach.

Setup

Use the package manager npm to install the ASE.

npm install

Initialization and Registration

Before initiating the API Gateway, please ensure the following steps:

  1. The three microservices: Api Syntactic Extractor, Api Dataset Generator, and Api Syntactic Similarity Analyzer are initialized.

  2. They are correctly registered on their respective ports.

The subsequent code snippet illustrates how the API Gateway registers these microservices using environment variables:

// Ommited details
const gateway = new ApolloGateway({
  supergraphSdl: new IntrospectAndCompose({
    subgraphs: [
      // Api Syntactic Extractor is in JS language
      {
        name: "Api Syntactic Extractor",
        url:
          process.env.API_SYNTACTIC_EXTRACTOR_URL ||
          "http://localhost:4001/graphql",
      },

      // Api Dataset Generator is in Python language
      {
        name: "Api Dataset Generator",
        url: process.env.API_DATASET_GENERATOR_URL || "http://localhost:4002",
      },

      // Api Syntactic Similarity Analyzer is in Python language
      {
        name: "Api Syntactic Similarity Analyzer",
        url:
          process.env.API_SYNTACTIC_SIMILARITY_ANALYZER_URL ||
          "http://localhost:4003",
      },
    ],
  }),
});
// Ommited details

Note:

  • The default microservices PORTS are 4001,4002, and 4003, but them can be changed for your convenience.

Usage

Before running the API Gateway, be sure to start it.

npm start

Access the ASE from the GraphQL endpoint:

http://localhost:4000/

Note:

  • The default PORT is 4000, but can be change for your convenience.
  • This project heavily relies on GraphQL, a powerful query language for APIs, and a server-side runtime for executing those queries with your existing data. If you're unfamiliar with GraphQL or wish to dive deeper, you can learn more about GraphQL here.

References

  • Agape Approach: As the Agape approach is being validated through conferences and journals, updates will be periodically provided here. Once the validation process concludes and findings are published, a direct link to the paper will be shared in this section for easy accessibility.

Project Status

The Agape Approach, currently in the evolutionary phase, functions as a proof of concept. It is actively undergoing improvements and changes to refine its capabilities and more effectively meet new requirements.

Author

Marcos Borges
PhD Student at Federal University of Ceará, Brazil
Email: [email protected]

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

api-gateway's People

Contributors

marcosborges1 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.