Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@m1k1o
Copy link
Contributor

@m1k1o m1k1o commented Nov 19, 2023

Just wrapper over http.StripPrefix that can be used as r.Use(middleware.StripPrefix("/api")).

@m1k1o m1k1o changed the title Add strip prefix middleware middleware: Add strip prefix middleware Mar 31, 2024
@m1k1o
Copy link
Contributor Author

m1k1o commented Jun 1, 2024

@pkieltyka could you please review this small PR?

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VojtechVitek
Copy link
Contributor

Tested with

	r := chi.NewRouter()
	
	r.Route("/_api", func(r chi.Router) {
		r.Use(middleware.StripPrefix("/_api"))
		r.Use(middleware.Heartbeat("/ping"))

		r.Handle("/rpc/*", rpcServerHandler)
	})

and it works well. πŸŽ‰

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

Successfully merging this pull request may close these issues.

2 participants