working sub
This commit is contained in:
14
main.go
14
main.go
@@ -8,14 +8,9 @@ import (
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := godotenv.Load(".env"); err != nil {
|
||||
log.Println("Error loading .env file. If you use docker, then you can ignore this.")
|
||||
}
|
||||
|
||||
app.LoadConfig()
|
||||
|
||||
r := chi.NewRouter()
|
||||
@@ -25,9 +20,12 @@ func main() {
|
||||
r.Use(middleware.Recoverer)
|
||||
r.Use(middleware.Timeout(60 * time.Second))
|
||||
|
||||
r.Post("/add", app.AddUser)
|
||||
r.Get("/config", app.GetConfig)
|
||||
r.Post("/delete", app.DeleteUser)
|
||||
r.Get("/users", app.AllUsers)
|
||||
r.Post("/users", app.AddUser)
|
||||
r.Get("/users/{id}", app.GetUser)
|
||||
r.Get("/users/{id}/key", app.GetUserKey)
|
||||
|
||||
r.Post("/connect", app.GetUserURL)
|
||||
r.Get("/sub/{id}", app.Sub)
|
||||
@@ -35,8 +33,8 @@ func main() {
|
||||
r.Post("/auth", app.DoAuth)
|
||||
|
||||
defer app.ClosePsql()
|
||||
log.Println("Listening on :8080")
|
||||
if err := http.ListenAndServe(":8080", r); err != nil {
|
||||
log.Println("Listening on :9999")
|
||||
if err := http.ListenAndServe(":9999", r); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user