-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (28 loc) · 870 Bytes
/
Copy pathmain.go
File metadata and controls
37 lines (28 loc) · 870 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
package main
import (
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
"github.com/imhemish/firstradio/common"
"github.com/imhemish/firstradio/handlers"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
app := fiber.New()
v1 := app.Group("/api/v1/")
v1.Post("/signup", handlers.Signup)
v1.Post("/login", handlers.Login)
protected := v1.Group("/protected")
protected.Use(jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{
Key: []byte(common.Secret),
},
}))
protected.Put("/profile", handlers.PutProfile)
protected.Get("/profile/:userid", handlers.GetProfile)
protected.Put("/password", handlers.PutPassword)
protected.Get("/artist/:artist", handlers.ArtistHandler)
protected.Get("/album/:album", handlers.AlbumHandler)
protected.Get("/track/:track", handlers.TrackHandler)
app.Listen(":8080")
}