Talks about building a basic web app in Go using net/http and goes over some of the available Go frameworks for building web apps. Finally wraps up with the necessary steps needed to build and deploy a Go Web App on the Heroku Platform.
each incoming request against a list of registered patterns & calls the handler for the pattern – mux := http.NewServeMux() – mux.HandleFunc("/", homeHandler) @gritncompassion
can be matched based on URL host, path, path prefix, schemes, header and query values, HTTP methods or using custom matchers. ▪ URL hosts, paths and query values can have variables with an optional regular expression. @gritncompassion
are only tested if the parent route matches. ▪ It implements the http.Handler interface so it is compatible with the standard http.ServeMux. @gritncompassion
or subdomain. – r := mux.NewRouter() – r.Host("www.foobar.com") // Only matches if domain is www.foobar.com – r.Host("{subdomain:[a-z]+}.domain.com") // Matches a dynamic subdomain @gritncompassion
-u github.com/revel/cmd/revel` ▪ Create an app with Revel `revel new <app_name>` ▪ Spin up the Server `revel run <app_name>` ▪ References: – https://github.com/revel/revel – https://revel.github.io/tutorial/requestflow.html @gritncompassion
view does revel render? – The application app/views/ directory and subdirectories. – revel core templates/ directory. – Otherwise a 500 error as template not found References: ▪ https://revel.github.io/manual/templates.html @gritncompassion
the Model. Similar to Active Record Validations. ▪ revel.Validation has a couple of methods that could be useful to you – required – Max – Min – Range – MinSize – MaxSize – Length @gritncompassion
govendor – Also supported: godep, glide, gb – dep(community supported) – https://devcenter.heroku.com/categories/managing-go-dependencies ▪ The main file shouldnot set the port . It should only set the port for local deployments @gritncompassion
you want a particular go version ▪ Install all packages ▪ The supported go versions are – https://devcenter.heroku.com/articles/go-support#go-versions ▪ References: – https://devcenter.heroku.com/articles/getting-started-with-go @gritncompassion