srv.go 391 B

12345678910111213141516171819202122232425262728
  1. package srv
  2. import (
  3. "fmt"
  4. "log"
  5. "net/http"
  6. "os"
  7. )
  8. var Config map[string]string
  9. func StartServer() {
  10. var PORT string = os.Args[1]
  11. Config = make(map[string]string)
  12. server := http.Server{
  13. Addr: fmt.Sprintf(":%v", PORT),
  14. Handler: rtr,
  15. }
  16. fmt.Println("Server Running")
  17. err := server.ListenAndServe()
  18. if err != nil {
  19. log.Fatalf("Server error: %v", err)
  20. os.Exit(1)
  21. }
  22. }