Managing Service Arguments and Dependencies in TypeScript for Testing

Is there a way to get arguments to a service?

  static Live = (route: string, request: express.Request) =>
    Effect.gen(function* () {
      const server_url = yield* Config.string('SERVER_URL');
      const url = new URL(route, server_url);
      const sessionCookie = request.cookies.session;
      const response = yield* fetchRoute({ url, request, cookie: sessionCookie });
      return response;
    });
}


I have something like this. However, I was hoping to maintain the Live property being just a layer that I can provide, so its easier to "swap" out dependencies for testing.

I'm not sure if what i'm thinking is overkill here though. I just am providing this service
Was this page helpful?