Implementing the main endpoint
There are so many solutions when it comes to implementing this gateway endpoint, and among them is having a simple REST API service in the top-level application with an integer path parameter that will identify the ID
parameter of the microservice. If the ID
parameter is invalid, the endpoint will only return the {'message': 'University ERP Systems'}
JSON string instead of an error. The following script is a straightforward implementation of this endpoint:
from fastapi import APIRouter router = APIRouter() @router.get("/university/{portal_id}") def access_portal(portal_id:int): return {'message': 'University ERP Systems'}
The access_portal
API endpoint is created as a GET path operation with portal_id
as its path parameter. The portal_id
parameter is essential to this process because it will determine which among the Student, Faculty, and Library microservices the user wants...