This middleware is used by all microservices. When the microservice is the auth service, it essentially invokes itself. When the microservice is not the auth service, it makes a remote call to the auth service.
Is this a good approach, or should I change the logic within the middleware so that the auth service avoids making a remote call to itself? Alternatively, should I use two different middlewares?
import type { ExpressMiddleware } from "@inversifyjs/http-express";
import type * as express from "express";
import { inject, injectable } from "inversify";
import {
type RemoteServiceClient,