HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
urfave
negroni
Go2014–2018
urfave / negroni

negroni

Idiomatic HTTP Middleware for Golang

11Distinct people
12Mentions
0Explicit recommenders
7.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Idiomatic HTTP Middleware for Golang

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year12 dated mentions

Observed mentions: 2014-09-02 23:17:53 UTC to 2018-07-14 05:06:31 UTC.

01232014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2018

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC303
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC303
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC202
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC303
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101

What Hacker News says

12 sources
To each their own, but I personally prefer the lego-building block-approach instead of the kitchen-sink approach of bigger frameworks. In Go at least, this scales quite nicely with your code IMO. I use a couple of thin layers over net/http: Gorilla mux: https://github.com/gorilla/mux ... Gets me easy route params and HTTP method filtering. Negroni for middleware: https://github.com/urfave/negroni ... Super easy to roll your own, plus there's a bunch of random off-the-shelf middlewares that people have put together (see their README). For talking with my DB, I just use sqlx (and sqlmock in my unit tests). https://github.com/jmoiron/sqlx https://github.com/DATA-DOG/go-sqlmock
In Ask HN: What is the current state of web frameworks in Golang?
And the same goes for Go. The only legitimate use of panic is still always-abort; recover merely helps one define what part of the program has aborted, and is a noop except within a deferred call — you'd be hard pressed to use recover as casually as exceptions in Java, Python or Ruby. Typically, this is the case when a master/workers scenario is implemented[0], where the master has to survive a worker's death, because they're different "processes", but the latter definitely dies from panicking (possibly even caused by a call to a third party lib such as described by kibwen) [0]: https://github.com/urfave/negroni/blob/master/recovery.go#L1...
In Implementing Go's defer keyword in C++
As you probably know (and as you can probably tell from some of the responses here), sometimes choosing languages can be like choosing a religion :-) As a backend for a web application, Go's performance is pretty great. The Go standard library comes with a fast parallel-enabled HTTP server that already makes use of all your cores in recent Go versions. No need for things like gunicorn to take advantage of cores. There's no interpreter overhead, and there's plenty of benchmark comparisons with other languages out there on Google. I've never heard of someone not using Go as a server-side language because it wasn't fast enough :-) Go has very robust support for creating web applications. Of course, for the frontend you will still need HTML+CSS+JS (maybe + a JS framework like Angular depending on your needs). There is a crazy experiment calle
Read the rest
d GopherJS to run Go in the browser/frontend, but currently, a crazy experiment is all it is IMO... For serving dynamic content, the Go standard library comes with its own templating language and library: https://golang.org/pkg/html/template/ The standard library also comes with most of the tools you'll need for defining HTTP routes (see the server examples): https://golang.org/pkg/net/http/ Personally, I've found the following third-party packages to be quite helpful with putting together HTTP server-side apps in Go: - Gorilla mux for defining templated routes: https://github.com/gorilla/mux - Negroni for HTTP route Middlewares: https://github.com/codegangsta/negroni For testing HTTP server-side Go applications, the httptest package is quite helpful: https://golang.org/pkg/net/http/httptest/ As you can see, most of what you need just comes with the standard library, which is quite professionally designed and coded (reading through their source is a pleasure). The two external dependencies I mentioned are helpful, but not a strict requirement to build a server-side app. The main obstacle people have with using Go IMO has little to do with its ability to be used as a server-side language, and more to do with the nature of the language, and the consequences of its design choices. I think people who strongly prefer terse dynamic languages have trouble adopting/enjoying Go and its way of doing things. For instance, someone in this thread said that Go's structs and static typing makes it harder to work with JSON. You could also make the argument that this is a strength- all I have to do is declare a struct to specify what exactly I want to read from / write to JSON. Some people have complained about Go's verbosity. Sometimes they are right- certain things in Go take a little more text to express. I'm convinced that Go is a language that is more optimized for readability than for writability. You typically can't write "expressive" koans in a line of code... but your teammates probably have a higher chance (in my subjective opinion) of understanding the Go code you wrote a year after you've forgotten what you were thinking about. I could go on and on, but now I'm just fighting the eternal language holy wars :-) I hope I've given you a starting point for more research if you were considering Go for a server-side web application.
In Go best practices, six years in
Don't get me wrong, I'm not saying that interface{} is a terrible thing. I spent a decade writing assembly language and then just as much in C and C++ before templates were usable, I know generics are far from essential and that a little controlled type unsafety is not a huge problem in practice. But: > you can code for a very long time without hitting your first interface{} Negroni, a popular and self-appointedly idiomatic library: https://github.com/codegangsta/negroni/blob/master/negroni_t... func expect(t *testing.T, a interface{}, b interface{}) func refute(t *testing.T, a interface{}, b interface{}) Ok, that's just for testing - it's not unusual to have to go off path to be able to test your code. How about Google's own standardized idiom for production code? https://blog.golang.org/context Value(key interface{}) interf
Read the rest
ace{} Or Go's own standard library? http://golang.org/pkg/encoding/json/ func Marshal(v interface{}) ([]byte, error) func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) func Unmarshal(data []byte, v interface{}) error No, it does not take such a long time.
In Avoiding Complexity with Go
I've also done a lot of Django hacking and have the same feelings about Python. You aren't going to find anything as complete as Django in Go. There just hasn't been enough consolidation on a single framework and things are too much in flux. I never found an ORM I liked, but pongo2 [1] is directly modeled after Django's templating language. There's also negroni [2] and its ecosystem. Gorilla [3] is an excellent set of packages as well. It all feels a lot like using a less mature Flask (mainly because Armin Ronacher has put years of work into it). As much as I want a speedup from Python (as well as good concurrency) I'm finding Python is still a lot more expressive and takes less code. Your mileage may vary. I suspect what Go would be really useful for is a JSON API that a Flask app (or something similar) consumes. 1. https://github.com/fl
Read the rest
In Django 1.7 Released

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.