Skip to content

chainhead/mysql-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql-demo

Demo of a simple NodeJS API querying a MySQL back-end

Introduction

This project demonstrates a NodeJS API querying a MySQL database. This project can be deployed on to an on-premises set-up or hosted on a VM on cloud.

Solution components

The following diagram illustrates the components of this solution. The complete solution is hosted on a Ubuntu 18.04 LTS t2.meduim virtual machine provisioned on AWS.

On-premise set-up

  • HTTPS end-point, load balancer, reverse proxy and API caching supprt for NodeJS application instances
  • Proxy server for MySQL database
  • MySQL database
  • API in NodeJS

Installation

To get started, head to project documentation.

API documentation

The APIs are documented are as follows.

Get registration numbers

  • Server: https://host

Request

Verb Endpoint Parameters Body
GET /regnums None None

Response

Code Description Type
200 Broker details for all registration numbers application/json

Example

{
    "r" : [
            {
                "REGISTRATION_NUM": "Registration Number",
                "BROKER_NAME": "AAA CAPITAL SERVICES PRIVATE LIMITED",
                "BROKER_TYPE": "finance",
                "TRADE_NAME": "AAAA CAPITAL SERVICES PRIVATE LIMITED",
                "EXCHANGE_NAME": "BOMBAY STOCK EXCHANGE LIMITED",
                "EMAIL_ADDRESS": "[email protected]",
                "BROKER_ADDRESS": "Calcutta"
            },
            {
                "REGISTRATION_NUM": "Registration Number",
                "BROKER_NAME": "BBB CAPITAL SERVICES PRIVATE LIMITED",
                "BROKER_TYPE": "finance",
                "TRADE_NAME": "BBBBB CAPITAL SERVICES PRIVATE LIMITED",
                "EXCHANGE_NAME": "BOMBAY STOCK EXCHANGE LIMITED",
                "EMAIL_ADDRESS": "[email protected]",
                "BROKER_ADDRESS": "Bombay"
            }
    ]
}

Get broker details by registration number

  • Server: https://host

Request

Verb Endpoint Parameters Body
GET /regnum/ Registration number None

Response

Code Description Type
200 Broker details for all registration numbers application/json

Example

{
    "r" :  {
            "REGISTRATION_NUM": "Registration Number",
            "BROKER_NAME": "AAA CAPITAL SERVICES PRIVATE LIMITED",
            "BROKER_TYPE": "finance",
            "TRADE_NAME": "AAAA CAPITAL SERVICES PRIVATE LIMITED",
            "EXCHANGE_NAME": "BOMBAY STOCK EXCHANGE LIMITED",
            "EMAIL_ADDRESS": "[email protected]",
            "BROKER_ADDRESS": "Calcutta"
        }
}

Get broker details through search

  • Server: https://host

Request

Verb Endpoint Parameters Body
GET /regnum/ None Search criteria

Search is allowed on following fields - individual or combination.

  • Broker name
  • Trade name
  • Broker address

Example:

  • Search by trade name only
{
    "search" : {
        "TRADE_NAME" : "CAPITAL"
    }
}
  • Search by broker name and address
{
    "search" : {
        "BROKER_NAME" : "CAPITAL",
        "ADDRESS" : "Nungambakkam"
    }
}

Response

Code Description Type
200 Broker details for all qualified search criteria application/json

Example

{
    "r" :  [
        {
            "REGISTRATION_NUM": "Registration Number",
            "BROKER_NAME": "AAA CAPITAL SERVICES PRIVATE LIMITED",
            "BROKER_TYPE": "finance",
            "TRADE_NAME": "AAAA CAPITAL SERVICES PRIVATE LIMITED",
            "EXCHANGE_NAME": "BOMBAY STOCK EXCHANGE LIMITED",
            "EMAIL_ADDRESS": "[email protected]",
            "BROKER_ADDRESS": "Calcutta"
        }
    ]
}

Releases

No releases published

Packages

No packages published