Last active
August 29, 2015 14:01
-
-
Save laser/c803ffd4729d73a5f60c to your computer and use it in GitHub Desktop.
Basic Server - Golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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