-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (29 loc) · 768 Bytes
/
main.go
File metadata and controls
38 lines (29 loc) · 768 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
30
31
32
33
34
35
36
37
38
package main
/*
Remember to structure via data.
ex:
Is there an email to send at subscription (email package)
Is there any permission on event creation, subscription? (permissions package)
USE Chi Render for responses and Content-Type JSON
*/
import (
"flag"
"fmt"
"log"
"net/http"
"github.com/pressly/chi"
)
func main() {
pathToConfig := flag.String("config", "config.json", "Path to config file")
flag.Parse()
service, err := newService(*pathToConfig)
if err != nil {
log.Fatal(err)
}
defer service.Close()
r := chi.NewRouter()
r.Use(initMiddleware(service))
r.Mount("/ntm-api", registerRoutes())
fmt.Println("Running on port:", service.Config.Port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", service.Config.Port), r))
}