Sunday, April 21, 2024
HomeGolangFull working HTTP server instance - Getting Assist

Full working HTTP server instance – Getting Assist


In one of many very earliest go language talks, Rob Pike exhibits an instance of a “sturdy and performant” HTTP server in about 10 traces of go. It was cute, however I used to be by no means positive it was practical. It appeared to me to deal with the webAPI-type capabilities, however didn’t to primary file contents supply.

Is there a contemporary, extra full model of an HTTP server written for a current or present launch of go? I’d love a hyperlink…

Pat

Effectively, http.ServeFile makes serving static content material very simple:

You may also have an interest on this enjoyable information:

Or possibly this:

You’re proper, the 10-line HTTP server from Rob Pike’s early Go speak was a simplified instance and never meant for real-world manufacturing use. Nevertheless, there are positively fashionable, extra full variations of HTTP servers written in Go that provide each internet API performance and file content material supply.

Sure, ideally, I’d discover a 30 or so line instance that may do each some internet API and boring previous content material supply. Again on the flip of the century, we’d typically do Java servlets in a Java layer, however simply dispatch boring content material supply to Apache or some equal. I’d fairly keep pure idiomatic go.

I’ve love a hyperlink to an appropriate instance?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments