Skip to content

Fiber: grouping routes #508

Answered by m-mattia-m
KrokoYR asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure if I understand you correctly, but you can see a working example for api-grouping with fiber below (without the /docs feature):

Consider that you have to specify the base path for the docs in the config, but there is no built-in functionality for multiple routing groups. (See)

As danielgtaylor mentioned here you can add a middleware which checks the incoming path to handle it.

One workaround I've seen a few people do is wrap your middleware in another which checks the incoming path and only applies whatever middleware you need based on that path. Another option is to convert to Huma middleware and use it with huma.Register.

	config.Servers = []*huma.Server{
		{URL: "http://…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KrokoYR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants