Skip to content

Instantly share code, notes, and snippets.

@m0sth8
Created August 29, 2014 12:27
Show Gist options
  • Save m0sth8/e04532d36ad4f295c834 to your computer and use it in GitHub Desktop.
Save m0sth8/e04532d36ad4f295c834 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"github.com/cocaine/cocaine-framework-go/cocaine"
)
func handler(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Pong"))
}
func main() {
binds := map[string]cocaine.EventHandler{
"ping": cocaine.WrapHandlerFunc(handler, nil),
}
if worker, err := cocaine.NewWorker(); err == nil{
worker.Loop(binds)
}else{
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment