read
Case Study: How to start a web server in go.
When i was first introduced to NodeJs I was fasinated by how you can start a web server with just couple of lines of code. Go is no less awesome.
I made the helloworld on web a bit more intresting - it will get your geolocation from your browser , use google maps simple REST interface to get your geography and print it.Code is documented, read the comments bottoms up.
so
- Go functions are First-Class
- Go variable can infer type if you say so using := .Note this is possibe only inside a func.
- Marking a statement as defer will run it before exiting func
And before i end this post, i used the cool navigator.geolocation.getCurrentPosition
of HTML5 to read your
geolocation
feel free to checkout and run the code.