mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-06-04 04:22:57 +00:00
30 lines
574 B
Go
30 lines
574 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
|
|
"containr/internal/apwhy/api"
|
|
"containr/internal/apwhy/config"
|
|
"containr/internal/apwhy/storage"
|
|
)
|
|
|
|
func main() {
|
|
cfg := config.Load()
|
|
|
|
store, err := storage.Open(cfg)
|
|
if err != nil {
|
|
log.Fatalf("failed to initialize storage: %v", err)
|
|
}
|
|
defer store.Close()
|
|
|
|
server := api.NewServer(store, cfg)
|
|
|
|
addr := fmt.Sprintf(":%d", cfg.Port)
|
|
log.Printf("APwhy server listening on http://localhost%s", addr)
|
|
if err := http.ListenAndServe(addr, server.Handler()); err != nil {
|
|
log.Fatalf("server exited: %v", err)
|
|
}
|
|
}
|