Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setupRoutes settings not working #6

Open
malaDev opened this issue Aug 30, 2022 · 3 comments
Open

setupRoutes settings not working #6

malaDev opened this issue Aug 30, 2022 · 3 comments

Comments

@malaDev
Copy link

malaDev commented Aug 30, 2022

I've tried to setup a bunch of setupRoutes params to my gateway but it seems not working at all.

After some checking , I realized that the option if not read (wondering if I did miss something)
Here is my use case:

func corsHandler(broker moleculer.BrokerContext, r *mux.Router) {
	cors := handlers.CORS(
		handlers.AllowedOrigins([]string{"*"}),
		handlers.AllowedMethods([]string{"GET", "POST", "DELETE", "PUT", "HEAD", "OPTIONS"}),
		handlers.AllowedHeaders([]string{"Content-Type", "X-Requested-With", "Authorization", "X-Workspace-ID"}),
	)

        // I've added a breakpoint here but nothing pass by here, neither during starting sequence or request execution
	cors(r)
}
	service := &gateway.HttpService{
		Settings: map[string]interface{}{
			"port": strconv.Itoa(setting.Port),
			"setupRoutes": []func(moleculer.BrokerContext, *mux.Router){
				corsHandler,
				injectResponseWriter,
			},
		},
                 Mixins: ...
@slaterx
Copy link
Member

slaterx commented Sep 5, 2022

@malaDev any chance you can provide the full use case? Or an example app on a repository?

@malaDev
Copy link
Author

malaDev commented Oct 29, 2022

the code I provided above is quite explicit I think
you can place breakpoint inside of it, you will notice the runtime will not pass by

@malaDev
Copy link
Author

malaDev commented Oct 29, 2022

anyway, I will prepare a PR for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants