[{"data":1,"prerenderedAt":296},["ShallowReactive",2],{"project-21723151":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":41,"post_text":44,"what":45,"said":76,"maker_in_thread":165,"shape":172,"grid":177,"attempts":251,"same_week":259,"maker_shows":211,"maker_hidden":288,"reader_version":289,"card":290},"21723151","Go web server","A Go web server with logging, tracing, and demo apps in a single file","title","Show HN: A Go web server with logging, tracing, and demo apps in a single file","https:\u002F\u002Fgithub.com\u002Fphotonlines\u002FGo-Web-Server","github.com","photon_lines",1575649158,2019,116,32,406,2195,19,"notable","languages","go web server example","other",[24,25,26,27],"go web server","go tracing","go logging","go example","roasted",-0.379,{"positive":31,"neutral":32,"mixed":33,"critical":34},1,6,0,8,15,{"idea":37,"design":38,"docs":39,"execution":40},{"positive":31,"critical":33},{"positive":33,"critical":34},{"positive":33,"critical":33},{"positive":33,"critical":33},[42,31,33,31,43,31,33,31,33,33,33,33,33,33,33,31,43,43,43,33,33,33,33,43,33,31,31,33,33,33,43,31],5,3,null,{"problem":46,"audience":56,"pricing":44,"motivation":63,"time_to_build":44,"stack":68,"openness":74,"stage":75,"team_size":75},{"value":47,"source":48,"evidence":49},"Teaching and demoing Go web server features in a single self-contained file","maker",[50,53],{"id":51,"by":11,"text":52},"21724473","I completely agree, although that also depends on what you're going for. My personal preference when learning something is to have everything in one place. That way, I can easily…",{"id":54,"by":11,"text":55},"21724633","I agree! The purpose of this was teaching, and not necessarily following all of the best practices! I made raw files which contain the go HTML templates, as well as the JS and…",{"value":57,"source":48,"evidence":58},"Developers learning Go",[59,62],{"id":60,"by":11,"text":61},"21724572","Thank you for the feedback!! The main.go file has comments within it that try to explain what each component does, and I tried to structure it in a way that makes it very easy to…",{"id":54,"by":11,"text":55},{"value":64,"source":48,"evidence":65},"Preference for having everything in one place when learning; focus on teaching Go features",[66,67],{"id":51,"by":11,"text":52},{"id":60,"by":11,"text":61},[69],{"value":70,"source":48,"evidence":71},"Go",[72],{"id":73},"post","open_source","unknown",{"praise":77,"objections":90,"requests":125,"questions":141,"alternatives":149},[78],{"value":79,"source":80,"evidence":81},"Single-file projects are useful for newbies to read and try out","commenter",[82,86],{"id":83,"by":84,"text":85},"21726767","erikig","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…",{"id":87,"by":88,"text":89},"21724747","user5994461","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…",[91,106,114],{"value":92,"source":80,"evidence":93},"Single file of about 885 lines is too big to read easily",[94,98,102],{"id":95,"by":96,"text":97},"21724043","laurent123456","> 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.",{"id":99,"by":100,"text":101},"21724271","Nextgrid","I agree. “Single file” projects are good for education if they’re short, but that many lines is just counter-productive.",{"id":103,"by":104,"text":105},"21727259","everdev","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…",{"value":107,"source":80,"evidence":108},"Inline HTML, CSS and JS in Go file is poor practice",[109,113],{"id":110,"by":111,"text":112},"21724185","Pelican","If \"in a single file\" means having your html and your javascript in your go file, that's not a feature...",{"id":103,"by":104,"text":105},{"value":115,"source":80,"evidence":116},"Logging to file is harder for Docker and log collection; should log to stderr",[117,121],{"id":118,"by":119,"text":120},"21724447","throwaway894345","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…",{"id":122,"by":123,"text":124},"21729691","aliswe","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…",[126,137],{"value":127,"source":80,"evidence":128},"Add a README reading guide or split code into modules",[129,133],{"id":130,"by":131,"text":132},"21724079","jerf","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,…",{"id":134,"by":135,"text":136},"21724355","SamWhited","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…",{"value":138,"source":80,"evidence":139},"Listen option should take an address rather than only a port",[140],{"id":134,"by":135,"text":136},[142],{"value":143,"source":80,"evidence":144},"Where is the HTML and CSS inlined in the Go code",[145],{"id":146,"by":147,"text":148},"21729377","zubairq","How do I see the HTML and css in the GO code? Is it inlined somewhere ?",[150,154,161],{"value":151,"source":80,"evidence":152},"Bottle (single-file Python web server)",[153],{"id":87,"by":88,"text":89},{"value":155,"source":80,"evidence":156},"MailHog (Go single binary SMTP server)",[157],{"id":158,"by":159,"text":160},"21724615","linsomniac","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…",{"value":162,"source":80,"evidence":163},"Twitter clone in Haskell single file",[164],{"id":83,"by":84,"text":85},{"comments":42,"answered":31,"key":166},[167,168,169],{"id":60,"text":61},{"id":51,"text":52},{"id":170,"text":171},"21725951","Cool and thanks for the feedback - yup, I actually played around with deploying it using GCP and had issues due to the logging, so I definitely regret not using stderr\u002Fstdout!!",{"commenters":173,"max_depth":174,"maker_replies":42,"first_comment_mins":175,"lifespan_hours":176},25,4,75,28,[178,180,182,186,187,189,190,192,195,198,201,202,203,206,208,210,212,216,218,221,224,227,230,231,232,235,238,239,242,243,246,247],[83,33,42,179,84,33],"project\u002Fpositive\u002Fidea",[103,33,31,181,104,33],"project\u002Fcritical\u002Fdesign",[183,33,33,184,185,33],"21729021","other\u002Fneutral\u002Fnone","rcarmo",[95,31,31,181,96,33],[130,31,43,188,131,33],"maker\u002Fneutral\u002Fdocs",[99,31,31,181,100,33],[60,31,33,191,11,31],"maker\u002Fneutral\u002Fnone",[193,31,31,181,194,33],"21724325","save_ferris",[196,31,33,197,131,33],"21724597","commenter\u002Fneutral\u002Fdesign",[199,31,33,184,200,33],"21725812","w0uld",[51,31,33,191,11,31],[158,31,33,184,159,33],[204,31,33,205,200,33],"21725880","commenter\u002Fneutral\u002Fnone",[207,31,33,205,159,33],"21728553",[87,31,33,209,88,33],"other\u002Fpositive\u002Fnone",[134,211,31,181,135,33],2,[213,211,43,214,215,33],"21724403","project\u002Fneutral\u002Fdocs","tikkabhuna",[118,43,43,217,119,33],"project\u002Fneutral\u002Fexecution",[219,43,43,217,220,33],"21724494","majormjr",[222,43,33,205,223,33],"21724663","ktm5j",[225,43,33,205,226,33],"21724862","anderspitman",[228,43,33,205,229,33],"21724876","btashton",[170,43,33,191,11,31],[122,43,43,217,123,33],[233,43,33,234,11,31],"21732381","maker\u002Fpositive\u002Fnone",[236,174,31,181,237,33],"21724052","sagichmal",[110,42,31,181,111,33],[240,42,33,197,241,33],"21724328","mdanger007",[54,42,33,188,11,31],[244,42,33,184,245,33],"21728453","whateveracct",[146,32,43,214,147,33],[248,249,31,181,250,33],"21724683",7,"aaronmgdr",[252,255,258],{"id":253,"t":254,"points":31,"comments":33},"21562045",1574053629,{"id":256,"t":257,"points":211,"comments":33},"21607142",1574440548,{"id":4,"t":12,"points":14,"comments":15},[260,265,270,274,279,283],{"id":261,"name":262,"points":263,"category":264},"21712403","Lucid Index \u002F Self Hosted Source",656,"dev_tools",{"id":266,"name":267,"points":268,"category":269},"21717022","AI Dungeon 2",584,"games",{"id":271,"name":272,"points":273,"category":269},"21719575","si78c",478,{"id":275,"name":276,"points":277,"category":278},"21757003","Kong",294,"finance_crypto",{"id":280,"name":281,"points":282,"category":264},"21742222","db",224,{"id":284,"name":285,"points":286,"category":287},"21751987","FATpick",190,"creative",false,"v2",{"id":291,"name":5,"line":6,"ai":288,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":292,"top":18,"kw":293,"maker":11,"domain":10,"tier":19,"attempts":43,"strip":294,"url":9,"mix":295,"praise":79,"objection":92,"sub":21},21723151,-0.38,[24,25,26,27],"51013101000000013330000301100031",[31,32,33,34],1794036583752]