I Don’t Like Go’s Default HTTP Handlers

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • web-util

    Useful abstraction above the http.Handler interface. Clean handlers without early returns

  • I was in the same camp as you a few years ago and also wrote an utility to handle this. Might be of any interest to you.

    https://github.com/barthr/web-util

  • ring

    Clojure HTTP server abstraction

  • > In the HTTP handlers it makes sense that you don't have return values, because: What would you do with that value exactly?

    I think that approach used by clojure's ring shows an elegant way to represent http responses https://github.com/ring-clojure/ring/wiki/Concepts#responses. They are essentially structs with the following fields:

    status := number

    headers := map of string->string

    body := stream | string | seq | inputstream

    Request handlers are handed a request struct that is similar. The handler is a function that maps a request to a response (it doesn't actually write to streams itself).

    I like this style for an http library for a couple of reasons:

    1. HTTP resources can be viewed as functions whose domain is the request, and range is the response. Having the abstraction match that makes for really nice code.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • ntfy

    Send push notifications to your phone or desktop using PUT/POST

  • oapi-codegen

    Generate Go client and server boilerplate from OpenAPI 3 specifications

  • The low level HTTP library is phenomenal for building more friendly packages on top, think of it as assembly language for HTTP in go. What isn't obvious about that Go http design is that it's very parallel. Your callback gets invoked in a goroutine for each request, so you can write easy to understand code, linearly, without worrying about things like promises or callbacks or message queues.

    I'm opinionated here, because I also think all API's should be built starting from a spec, such as OpenAPI, and to that end, I've written a library to do just that, generate models and echo handlers from API specs, and other contributors have added gin, chi, etc [1]

    1: https://github.com/deepmap/oapi-codegen

  • httperroryzer

    Static analyzer to catch invalid uses of http.Error without a return statement which can cause expected bugs

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • what componies uses Clojure, and what componies deceased the use of other languages after additions of Clojure, for example Dropbox decrease the use of python after addition of Go programming language, are there any similar story with Clojure?

    2 projects | /r/Clojure | 2 Oct 2022
  • Coast on Clojure

    11 projects | news.ycombinator.com | 5 Apr 2022
  • is bulding rest apis with clojure a good idea ?

    2 projects | /r/Clojure | 11 Jul 2021
  • Donkey - new clojure HTTP lib by Appsflyer Engineering

    8 projects | /r/Clojure | 12 Jan 2021
  • Clojure na Web com Ring

    2 projects | dev.to | 8 Jan 2021