This repository has been archived on 2024-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
golang-rest-example/cmd/server.go

24 lines
401 B
Go
Raw Normal View History

2024-02-01 18:57:25 +00:00
package main
import (
"log"
"net/http"
"github.com/mentos1386/golang-rest-example/pkg/api"
2024-02-01 22:09:09 +00:00
"github.com/mentos1386/golang-rest-example/pkg/openapi"
2024-02-01 18:57:25 +00:00
)
func main() {
2024-02-01 22:09:09 +00:00
service := &api.ApiService{}
2024-02-01 18:57:25 +00:00
2024-02-01 22:09:09 +00:00
srv, err := openapi.NewServer(service)
2024-02-01 18:57:25 +00:00
if err != nil {
log.Fatal(err)
}
2024-02-01 22:09:09 +00:00
log.Println("Starting server on :1234")
if err := http.ListenAndServe(":1234", srv); err != nil {
2024-02-01 18:57:25 +00:00
log.Fatal(err)
}
}