Created
May 2, 2020 13:29
-
-
Save RubaXa/dc5af1618ae485e7ca34f3d6e25ae90b to your computer and use it in GitHub Desktop.
This file contains 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" | |
"log" | |
"github.com/gothing/draft" | |
"github.com/gothing/draft-demo/auth" | |
) | |
const srv = "localhost:2047" | |
func main() { | |
// Создаём API-контейнер | |
api := draft.Create() | |
// Добавляем «сервисы» | |
api.Add(auth.Service) | |
// Принтим всё, что получилось | |
fmt.Printf("Server: http://%s\n", srv) | |
fmt.Printf(" - http://%s/godraft:docs/\n", srv) | |
fmt.Printf(" - http://%s/godraft:scheme/\n\n", srv) | |
fmt.Println("API:") | |
for _, u := range api.URLs() { | |
fmt.Printf(" --> http://%s%s\n", srv, u) | |
} | |
fmt.Println("") | |
// Стартуем сервер | |
err := api.ListenAndServe(srv) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment