forked from rusq/aklapi
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (23 loc) · 635 Bytes
/
main.go
File metadata and controls
29 lines (23 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"log"
"net/http"
"github.com/rusq/aklapi/aklapi"
"github.com/rusq/osenv/v2"
)
const (
root = "/"
apiRoot = "/api/v2"
apiAddress = apiRoot + "/address/"
apiDates = apiRoot + "/dates/"
apiCollections = apiRoot + "/collections/"
)
var port = osenv.Value("PORT", "8080")
func main() {
http.HandleFunc(root, aklapi.RootHandler)
http.HandleFunc(apiAddress, aklapi.AddressHandler)
http.HandleFunc(apiDates, aklapi.DatesHandler)
http.HandleFunc(apiCollections, aklapi.CollectionsHandler)
log.Printf("Listening on :%s", port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}