-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
41 lines (34 loc) · 838 Bytes
/
main.go
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
import (
"net/http"
"github.com/athul/anonblog/api"
"github.com/athul/anonblog/db"
"github.com/gin-gonic/gin" // jwtware
)
func main() {
// app := fiber.New()
r := gin.Default()
db.ConnectDB()
setupRoutes(r)
// app.Listen(3000)
r.Run()
}
func setupRoutes(r *gin.Engine) {
// api := app.Group("/api", func(c *fiber.Ctx) {
// c.Set("X-Custom-Header", "isafgiwegfuiqwgfivfberik")
// c.Next()
// })
// api.Use(jwtware.New(jwtware.Config{
// SigningKey: []byte("secret"),
// }))
// r.POST("/new", createNew)
// r.GET("/list", list)
r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"data": "hello world"})
})
r.POST("/#", api.Newuser)
r.GET("/users.all", api.GetUsers)
r.GET("/users/:id", api.FindUserbyID)
r.POST("/hack.new", api.Newhack)
r.GET("/hacks.all", api.GetHacks)
}