Skip to content

setupRoutes settings not workingΒ #6

@malaDev

Description

@malaDev

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: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions