Live data from Hacker News

Show HN: A simple Go web server with logging, tracing, health check

gist.github.com

51–60 of 97 posts

Re: Show HN: A simple Go web server with logging, tracing, health check

#51

Yea lets ditch everything we learned about modularization in the past 20 years and put everything in one single binary

This is merely an example server with a router, middleware and two route handlers. This isn’t evangelism for monolithic application design, and there’s nothing inherent in Go that forces monolithic application design.

Re: Show HN: A simple Go web server with logging, tracing, health check

#52
post #23

Golang is self sufficient for a small scale web app. It has HTML templates library, decent error handling, rpc, logging, built-in http server. Many people choose golang for that reason.

What do you mean by small scale? I think requests per second. Our Go-backed API has handled 90k rps without batting an eye. Or do you mean small scale as in team size? It is my understanding that Go was specifically designed to work for large organizations ( cough Google cough ). Or do you mean single page JavaScript web sites? At which point Go would be the backing API? I don't see what qualifies Go for "small scale…

I would say "small scale" would refer to project size in Go.

Re: Show HN: A simple Go web server with logging, tracing, health check

#53
post #38

Here's a quick attempt at the same thing in Java (although note that the command line format is different): https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c... The main takeaway is that the JDK's built-in web server is poor: * There is no way to configure timeouts * Filters have to be added to each handler separately, by mucking with its filter list * Filters have to extend an abstract class with two meth…

Hi twic, thanks for sharing this! I love to see implementation in other languages. I'm particularly interested in Rust, it would be awesome if anyone can make a attempt! :)

That would be awesome, but note that Rust, due to it being a low-level language, doesn't really have a net/http equivalent in its standard library and therefore any implementation would be more of a representation of the 3rd party libraries used.

Re: Show HN: A simple Go web server with logging, tracing, health check

#54
post #52

Earlier quoted context omitted.

What do you mean by small scale? I think requests per second. Our Go-backed API has handled 90k rps without batting an eye. Or do you mean small scale as in team size? It is my understanding that Go was specifically designed to work for large organizations ( cough Google cough ). Or do you mean single page JavaScript web sites? At which point Go would be the backing API? I don't see what qualifies Go for "small scale…

I would say "small scale" would refer to project size in Go.

Thanks

Re: Show HN: A simple Go web server with logging, tracing, health check

#55
post #38

Here's a quick attempt at the same thing in Java (although note that the command line format is different): https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c... The main takeaway is that the JDK's built-in web server is poor: * There is no way to configure timeouts * Filters have to be added to each handler separately, by mucking with its filter list * Filters have to extend an abstract class with two meth…

Yea, the built-in JDK HTTP server is pretty poor, but I don't think I've ever run across it in the wild thankfully.

> There is no way to configure timeouts

They're configured by properties if I recall.

> Filters have to be added to each handler separately, by mucking with its filter list

I personally prefer the explicitness of this.

As for the rest... I think a lot of these issues stem from the fact it's an old, not particularly well-known API in the JDK.

Re: Show HN: A simple Go web server with logging, tracing, health check

#56
post #38

Here's a quick attempt at the same thing in Java (although note that the command line format is different): https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c... The main takeaway is that the JDK's built-in web server is poor: * There is no way to configure timeouts * Filters have to be added to each handler separately, by mucking with its filter list * Filters have to extend an abstract class with two meth…

Just wrap the handlers with middleware rather than using that filter abstraction.

Same thing!

Re: Show HN: A simple Go web server with logging, tracing, health check

#57
post #23

Golang is self sufficient for a small scale web app. It has HTML templates library, decent error handling, rpc, logging, built-in http server. Many people choose golang for that reason.

What do you mean by small scale? I think requests per second. Our Go-backed API has handled 90k rps without batting an eye. Or do you mean small scale as in team size? It is my understanding that Go was specifically designed to work for large organizations ( cough Google cough ). Or do you mean single page JavaScript web sites? At which point Go would be the backing API? I don't see what qualifies Go for "small scale…

Not akditer, but I think the key words are "self sufficient," i.e., the Go standard library provides a great deal of core functionality out of the box.

A larger project is more likely to require features provided by third-party packages.

Re: Show HN: A simple Go web server with logging, tracing, health check

#58
post #38

Here's a quick attempt at the same thing in Java (although note that the command line format is different): https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c... The main takeaway is that the JDK's built-in web server is poor: * There is no way to configure timeouts * Filters have to be added to each handler separately, by mucking with its filter list * Filters have to extend an abstract class with two meth…

Nice. Does anyone have a server like this but with the addition of

* serving of files and directories

* LetsEncrypt certificates and SSL

Re: Show HN: A simple Go web server with logging, tracing, health check

#59

Earlier quoted context omitted.

Hi chrisper, you are right! This is just a reminder for me on how to do those things when I start a new app in Go, instead of always google for them.

I like how you, as the owner of the repo and poster, agreed with me, yet I got -3 points...

Look at all the other gray comments here. Any comment questioning why this is so great appears to be severely triggering the masses.

Re: Show HN: A simple Go web server with logging, tracing, health check

#60
post #44
post #36

Earlier quoted context omitted.

Iris is a poorly maintained project that I would not recommend for production use. See the drama unfold at https://www.reddit.com/r/golang/comments/57w79c/why_you_real... and https://www.reddit.com/r/golang/comments/57tmp1/why_you_shou...

Well, it _seemed_ nice. Regardless, I'm a bit more concerned with back-office scaffoldings myself. Any pointers?

I wrote a scaffold generator here you may find interesting.

https://github.com/fragmenta/fragmenta

It’s fairly simple to write some simple generator using the built in text/template package if all you want are admin scaffolds.

Post reply on HN