params consolidation, fixed numeric params
This commit is contained in:
10
cmd/api.go
10
cmd/api.go
@ -1,20 +1,18 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/gin-gonic/gin"
|
||||
"git.icod.de/dalu/refdata/api/handler"
|
||||
"git.icod.de/dalu/refdata/api/repo"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/globalsign/mgo"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// apiCmd represents the api command
|
||||
var apiCmd = &cobra.Command{
|
||||
Use: "api",
|
||||
Short: "starts serving the api",
|
||||
Long: `starts serving the api`,
|
||||
Long: `starts serving the api`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ms, e := mgo.Dial("localhost")
|
||||
if e != nil {
|
||||
@ -24,7 +22,7 @@ var apiCmd = &cobra.Command{
|
||||
r := gin.Default()
|
||||
api := r.Group("/api/v1")
|
||||
|
||||
dataRepo := repo.NewDataRepository(ms, "ApiName", "data")
|
||||
dataRepo := repo.NewDataRepository(ms, "apiname", "data")
|
||||
h := handler.NewHandler(dataRepo)
|
||||
h.DataRoutes(api)
|
||||
|
||||
|
Reference in New Issue
Block a user