-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
59 lines (52 loc) · 1.07 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"log"
"os"
"github.com/lily-lee/blog-server/cmd"
"github.com/lily-lee/blog-server/config"
"github.com/urfave/cli/v2"
)
func init() {
config.Init()
}
// @title blog api server
// @version 1.0
// @description This is a blog api server, serves api for blog web frontend.
// @contact.name lily-lee
// @contact.email lilylee99.01@gmail.com
// @host localhost:3000
// @BasePath /
func main() {
app := &cli.App{
Commands: []*cli.Command{
{
Name: "blog",
Usage: "start blog server",
Action: func(c *cli.Context) error {
fmt.Println("start blog server ...")
return cmd.BlogServer()
},
},
{
Name: "migrate",
Usage: "db migrate",
Action: func(c *cli.Context) error {
fmt.Println("start db migrate...")
return cmd.Migrate()
},
},
{
Name: "rollback",
Usage: "db rollback",
Action: func(c *cli.Context) error {
fmt.Println("start db rollback...")
return cmd.Rollback()
},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}