Is your feature request related to a problem? Please describe.
I have the number of APIs
"POST /users": "v1.users.register",
"POST /users/authenticate": "v1.users.authenticate",
"POST /users/activate": "v1.users.activate"
These aliases are listed in API Gateway service
My project is a multitenant microservice which has different types for user creation, authentication and activation.
And I want to keep the same REST APIs.
So I wanted to add the middleware for alias /users/authenticate and check if the client supports the requested authentication type from the request body.
Describe the solution you'd like
Just as the route middleware using use object, do we have middleware based on alias?
It would be great if you could suggest me the recommended way for this problem
hello,
You can use an array to use a middleware like this:
"POST /users": [myMiddleware1, myMiddleware2,"v1.users.register"]
Thanks @molobala , I'll try this :)
Can you please provide the link of your solution?
I want to dig deep into it
@SushKenyNeosoft you can read more about middleware here https://moleculer.services/docs/0.13/moleculer-web.html#Middlewares
Most helpful comment
hello,
You can use an array to use a middleware like this:
"POST /users": [myMiddleware1, myMiddleware2,"v1.users.register"]