Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laser/c803ffd4729d73a5f60c to your computer and use it in GitHub Desktop.
Save laser/c803ffd4729d73a5f60c to your computer and use it in GitHub Desktop.
Basic Server - Golang
package main
import (
"fmt"
"github.com/coopernurse/barrister-go"
"todo_manager"
)
func NewTodoManagerProxy(url string) todo_manager.TodoManager {
trans := &barrister.HttpTransport{Url: url}
client := barrister.NewRemoteClient(trans, true)
return todo_manager.NewTodoManagerProxy(client)
}
func main() {
proxy := NewTodoManagerProxy("http://localhost:3000/v1/todos")
props := todo_manager.TodoProperties{"Call Dad", false}
res, err := proxy.CreateTodo(props)
if err == nil {
fmt.Println(res)
} else {
fmt.Println("ERROR! ", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment