Skip to content

Instantly share code, notes, and snippets.

@RubaXa
Created May 2, 2020 13:29
Show Gist options
  • Save RubaXa/dc5af1618ae485e7ca34f3d6e25ae90b to your computer and use it in GitHub Desktop.
Save RubaXa/dc5af1618ae485e7ca34f3d6e25ae90b to your computer and use it in GitHub Desktop.
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