-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (32 loc) · 901 Bytes
/
main.go
File metadata and controls
41 lines (32 loc) · 901 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
39
40
41
package main
/*
This is just an quick setup of the main file
*/
import (
"errors"
"flag"
"log"
"net/http"
"github.com/IanVinkHub/gojapi/app/jio"
"github.com/IanVinkHub/gojapi/controllers"
)
var addr = flag.String("addr", "0.0.0.0:8080", "http service address")
func fallback(w http.ResponseWriter, r *http.Request) {
jio.Error(w, errors.New("Endpoint not found"), 404)
}
func channelHandler() {
for {
select {}
}
}
func main() {
http.HandleFunc("/", fallback)
http.HandleFunc("/auth/login", controllers.Login)
http.HandleFunc("/auth/logout", controllers.Logout)
http.HandleFunc("/auth/register", controllers.Register)
http.HandleFunc("/auth/changepassword", controllers.Changepassword)
http.HandleFunc("/auth/token", controllers.GetTokenInfo)
http.HandleFunc("/auth/refresh", controllers.RefreshTokenPost)
go channelHandler()
log.Fatal(http.ListenAndServe(*addr, nil))
}