Go web server

Languages and libraries

go web server example

SHOW HN2019

Go web server

A Go web server with logging, tracing, and demo apps in a single file

github.com

#go web server#go tracing#go logging#go example

116points
32comments
#406of 2,195 in 2019
Top 19%of 2019 by points

How HN took it

RoastedHalf or more of the comments are critical

1 positive, 6 neutral or asking, 0 mixed, 8 critical, out of 15 comments about the project. Thread score -0.38.

Design: 0 for, 8 againstIdea: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Single-file projects are useful for newbies to read and try out

    From 2 comments
    • I'm enjoying these "in a single file" projects. They aren't often the paragon of best-practices but they make it easy for newbies to peep in on the syntax and see how complex…
      erikig on HN
    • There is a widely popular web server in python that is a single file. I find it quite readable and it's well documented. It helped me immensely on a few projects where there was…
      user5994461 on HN

Objections

  • Single file of about 885 lines is too big to read easily

    From 3 comments
    • > all in a single file It's not really an advantage, is it? Having everything mixed up into one giant file just makes the code much harder to make sense of.
      laurent123456 on HN
    • I agree. “Single file” projects are good for education if they’re short, but that many lines is just counter-productive.
      Nextgrid on HN
    • It is an interesting idea, but it can be overkill. Just because it can be done doesn't mean it should be. For example, there are ~130 lines of CSS in the Go file. Most editors…
      everdev on HN
  • Inline HTML, CSS and JS in Go file is poor practice

    From 2 comments
    • If "in a single file" means having your html and your javascript in your go file, that's not a feature...
      Pelican on HN
    • It is an interesting idea, but it can be overkill. Just because it can be done doesn't mean it should be. For example, there are ~130 lines of CSS in the Go file. Most editors…
      everdev on HN
  • Logging to file is harder for Docker and log collection; should log to stderr

    From 2 comments
    • This is really cool! One suggestion: logging to a file makes it harder for things like Docker to exfiltrate logs. Log to stderr by default, and the caller can redirect to a file…
      throwaway894345 on HN
    • Not be to dogmatic but thus is really good: > A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage…
      aliswe on HN

Requests

  • Add a README reading guide or split code into modules

    From 2 comments
    • As feedback to the author, since the author seems to also be the HN poster, I would agree with this. If it were the only meaningful file in the project, maybe it'd be worthwhile,…
      jerf on HN
    • Might be worth structuring this like a normal Go project (eg. right now this is in a package called "src", which is not great) if it's meant for education. Also the listen…
      SamWhited on HN
  • Listen option should take an address rather than only a port

    From 1 comment
    • Might be worth structuring this like a normal Go project (eg. right now this is in a package called "src", which is not great) if it's meant for education. Also the listen…
      SamWhited on HN

Questions

  • Where is the HTML and CSS inlined in the Go code

    From 1 comment
    • How do I see the HTML and css in the GO code? Is it inlined somewhere ?
      zubairq on HN

Alternatives named

  • Bottle (single-file Python web server)

    From 1 comment
    • There is a widely popular web server in python that is a single file. I find it quite readable and it's well documented. It helped me immensely on a few projects where there was…
      user5994461 on HN
  • MailHog (Go single binary SMTP server)

    From 1 comment
    • We use a Go app called MailHog, which is a SMTP server for development use. It also has a web interface for management. All in a single go file (SMTP server, HTTP server, plus…
      linsomniac on HN
  • Twitter clone in Haskell single file

    From 1 comment
    • I'm enjoying these "in a single file" projects. They aren't often the paragon of best-practices but they make it easy for newbies to peep in on the syntax and see how complex…
      erikig on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/21723151)