background preloader

Golang

Facebook Twitter

Any good examples of REST-based servers written in Go? : golang. Gorilla, the golang web toolkit. Bmizerany/pat. Gorest - A RESTful style web-services framework for the Go language. //************************Define Service*************************** type OrderService struct{ //Service level config gorest.RestService `root:"/orders-service/" consumes:"application/json" produces:"application/json"` //End-Point level configs: Field names must be the same as the corresponding method names, // but not-exported (starts with lowercase) //Handler Methods: Method names must be the same as in config, but exported (starts with uppercase) func(serv OrderService) ListItems()[]Item{ serv.ResponseBuilder().CacheMaxAge(60*60*24) //List cacheable for a day. Func(serv OrderService) AddItem(i Item){ for _,item:=range itemStore{ if item.Id == i.Id{ item=i serv.ResponseBuilder().SetResponseCode(200) //Updated http 200, or you could just return without setting this. 200 is the default for POST return } } //Item Id not in database, so create new i.Id = len(itemStore) itemStore=append(itemStore,i) userStore[user.Id]=user.

Restful url - How to create REST URLs without verbs. Stretchrcom/goweb. Google I/O 2012 - Go in Production. StatHat. Juju DevOps. GoCI. Writing, building, installing, and testing Go code. Golang unittest testing. Tutorial Un Sitio Web Entero. Writing Web Applications. Introduction Covered in this tutorial: Creating a data structure with load and save methodsUsing the net/http package to build web applications Using the html/template package to process HTML templatesUsing the regexp package to validate user inputUsing closures Assumed knowledge: Programming experienceUnderstanding of basic web technologies (HTTP, HTML)Some UNIX/DOS command-line knowledge Getting Started At present, you need to have a FreeBSD, Linux, OS X, or Windows machine to run Go.

Install Go (see the Installation Instructions). Make a new directory for this tutorial inside your GOPATH and cd to it: $ mkdir gowiki $ cd gowiki Create a file named wiki.go, open it in your favorite editor, and add the following lines: package main import ( "fmt" "io/ioutil" ) We import the fmt and ioutil packages from the Go standard library. Data Structures Let's start by defining the data structures.

Type Page struct { Title string Body []byte } The type []byte means "a byte slice" . $ go build wiki.go $ . Simple chat using websocket with golang. Go: Code that Grows with Grace. Cuddle, A go AppEngine Demo - Andrew Gerrand. Let's Go Further: Build Concurrent Software using the Go Programming Language. A Tour of Go. Golang, practical Go Programming. Google I/O 2012 - Go Concurrency Patterns. Google I/O 2011: Writing Web Apps in Go. Cuddle, A go AppEngine Demo - Andrew Gerrand.