From 59ab751453799971939696867c6b6d9f37bb411b Mon Sep 17 00:00:00 2001 From: Michael Demetriou Date: Fri, 20 Sep 2019 16:56:00 +0300 Subject: [PATCH] Add ServeSingleActor() for easier onboarding --- http.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/http.go b/http.go index dca1e8b..8defa01 100644 --- a/http.go +++ b/http.go @@ -13,6 +13,12 @@ import ( "encoding/json" ) +// ServeSingleActor just simplifies the call from main so +// that onboarding is as easy as possible +func ServeSingleActor(actor Actor) { + Serve(map[string]Actor{actor.Name: actor}) +} + // Serve starts an http server with all the required handlers func Serve(actors map[string]Actor) { @@ -261,7 +267,8 @@ func Serve(actors map[string]Actor) { case "Create": actor, ok := actors[mux.Vars(r)["actor"]] // load the actor from memory if !ok { - log.Error("No such actor") + // log.Error(actors) + log.Error("No such actor: " + mux.Vars(r)["actor"]) return } actor.OnReceiveContent(activity)