Skip to content

Creating service per HttpRequest #591

@TKul6

Description

@TKul6

Hi,

I have routing-controllers over Express server.
I inject services to the controllers, and I wonder if there is a way to create a service per HTTP request?

A more concrete example: I have a cache service that store data based on the locale of the request.
In order to get the right locale I need to somehow get the the locale from the request.

I'd like to avoid manually sending the request every time I execute GET / SET / DEL.

I thought about creating a middleware , inject the service the service there and manually set the active request there. To do that however, I need some way to create a service per request to make sure there will be no collision between requests.

Do you have any idea how can I achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: awaiting answerAwaiting answer from the author of issue or PR.type: discussionIssues discussing any topic.type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions