forked from alpody/golang-fiber-realworld-example-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (35 loc) · 898 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
42
43
44
//go:generate swag init
//You must first install https://github.com/arsmn/fiber-swagger
package main
import (
"fmt"
"github.com/alpody/fiber-realworld/db"
_ "github.com/alpody/fiber-realworld/docs"
"github.com/alpody/fiber-realworld/handler"
"github.com/alpody/fiber-realworld/router"
"github.com/alpody/fiber-realworld/store"
"github.com/gofiber/swagger"
)
// @description Conduit API
// @title Conduit API
// @BasePath /api
// @schemes http https
// @produce application/json
// @consumes application/json
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name Authorization
func main() {
r := router.New()
r.Get("/swagger/*", swagger.HandlerDefault)
d := db.New()
db.AutoMigrate(d)
us := store.NewUserStore(d)
as := store.NewArticleStore(d)
h := handler.NewHandler(us, as)
h.Register(r)
err := r.Listen(":8585")
if err != nil {
fmt.Printf("%v", err)
}
}