Monday, May 20, 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 reveals an instance of a “sturdy and performant” HTTP server in about 10 strains of go. It was cute, however I used to be by no means positive it was life like. It regarded to me to deal with the webAPI-type features, however didn’t to fundamental 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

Properly, http.ServeFile makes serving static content material very straightforward:

You may additionally 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 trendy, 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 outdated 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 relatively keep pure idiomatic go.

I’ve love a hyperlink to an appropriate instance?

Than you for the data.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments