From 8c96b6af766254e3d227e4d7e5f3da0bb95ca664 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 7 Jul 2018 18:17:52 +0200 Subject: [PATCH] update readme --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 493eb00..e3c4701 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,41 @@ Options: +#### 4. Main in go + +The main program is pretty small, it is as followed : + +```go +package main + +import ( + "os" + "git.xdrm.io/go/aicra" +) + +func main() { + + // 1. init with manifest file + server, err := aicra.Init("manifest.json") + + if err != nil { + fmt.Printf("cannot load config : %s\n", err) + os.Exit(1) + } + + // 2. Launch server + fmt.Printf("[Server up] 0.0.0.0:4242\n") + err = server.Launch(4242) + + if err != nil { + fmt.Printf("[FAILURE] server failed : %s\n", err) + os.Exit(1) + } +} +``` + + +