Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sahilmankar/API-Gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to API-Gateway Project👋

Accessing API using Ocelot API Gateway

This project contains TWO API'S


  • DepartmentAPI
  • ProductAPI

Before proceed further please install .NET Core 7.0 , MySQL , Node.js , Postman
First Talk about DepartmentAPI :

This API is Built using .NET Core 7.0, C# , MySQL , EntityFrameworkCore

To run DepartmentAPI first create database in mysql as transflower and import Departments.sql in it
or you can choose any database but don't forgot to edit ConnectionString in CollectionContext.cs

It will run on port 5002

The Second is ProductAPI :

Which is Built using Node.js, Express ,MySQL
To run ProductAPI first create database in mysql as actsdb or you can use already crated Database and import products.sql in it
Make Sure changes in db.js for ConnecionString
It will run on port 3000

After this finally run a Gateway project which have all rounting configuration
It will run on port 5000
If you have any services preconfigured with above ports please make changes
Hope all things gone ok ,mostly it will be ok if you have proper database setup


To run all projects you can just click on run.bat(batch) file

Open Postman for API testing
And Try following URL

  1. The URL will Show all departments data . request-type GET
        http://localhost:5000/departments

  1. The URL will Show department data by id . request-type GET
        http://localhost:5000/departments/1

3.The URL will Insert department data . request-type POST

       http://localhost:5000/departments/insert

For inserting data select Body-> raw -> JSON
The data will be type of JSON Object<b>

{
    "name": "Analytics",
    "location": "Punjab"
}

Id will be automatically inserted as it is auto_incremented


4.The URL will Update department data . request-type PUT

       http://localhost:5000/departments/update

For updating data select Body-> raw -> JSON
The data will be type of JSON Object<b>

{  
    "id": 15,
    "name": "Analytics",
    "location": "Punjab"
}

It will update data of existing record


  1. The URL will delete department by id . request-type DELETE
        http://localhost:5000/departments/delete/1

The Same goes for ProductAPI


  1. The URL will Show all products data . request-type GET
        http://localhost:5000/products

  1. The URL will Show product data by id . request-type GET
        http://localhost:5000/products/2

3.The URL will Insert product data . request-type POST

       http://localhost:5000/products/insert

For inserting data select Body-> raw -> JSON
The data will be type of JSON Object<b>

{  
    "title": "knor soup",
    "description": " spicy ",
    "price": 110
}

Id will be automatically inserted as it is auto_incremented


4.The URL will Update product data . request-type PUT

       http://localhost:5000/products/update/2

here 2 is Id
For updating data select Body-> raw -> JSON
The data will be type of JSON Object<b>

{  
    "title": "knor soup",
    "description": " mid-spicy ",
    "price": 90
}

It will update data of existing record


  1. The URL will delete product by id . request-type DELETE
        http://localhost:5000/products/delete/2

Give a ⭐️ if this project helped you!

About

Accessing API using Ocelot API Gateway

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published