params consolidation, fixed numeric params

This commit is contained in:
Darko Luketic
2018-03-28 04:24:06 +02:00
parent 80abb6a862
commit 6761f8d666
3 changed files with 99 additions and 134 deletions

View File

@ -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)