Chi for Routing
Sep 6, 2018
2 minutes read

I have decided to move a way from gorilla/mux because it is too basic and provides very little advantage over the bare http library in the standard library. However, the standard library is very minimal for supporting and sort of very slightly advance routing. For example, if you want to route something like users/{id}/roles to a certain handler and extract the id from the route, the basic http package does not help with that. This is, frankly, is a basic need.

After looking at my pros and cons with the libraries around, I feel very comfortable with chi. There are three reasons for this:

  1. chi is being used by many applications, and some are in stable companies. This includes Heroku and cloudflare. This gives me confidence that there will be a community around chi for a long while, and that development will be active.
  2. chi mux is compatible with the standard package. This is important to me because I do not want a whole framework for my application. I just want the routing. A framework requires a long time to know how things work, and they tend to be opinionated enough where I can find cases that would not match the frameworks design. chi is a small straightforward library.
  3. chi does not have external dependencies. I hate dependencies, and the less I have the better I am. The fact that chi does not borrow anything else means I feel comfortable about knowing what I am using for routing, and that the changes in chi will be stable instead of volatile. More dependencies means more keeping up with changes in the dependencies. So, if you have not tried anything before, I definitely recommend chi.

Back to posts