diff --git a/README.md b/README.md new file mode 100644 index 0000000..bafa171 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# CertifiedInvSWDB +Small API to serve the currently existing certified invoicing softwares in +Portugal. + +With it there's a small CLI to help scraping new data to populate the DB. diff --git a/api/api.go b/api/api.go index 7130774..88b7375 100644 --- a/api/api.go +++ b/api/api.go @@ -1,10 +1,8 @@ // Package api will server the SW data via a JSON REST API. package api -// TODO: configure the logging import ( "net/http" - // _ "net/http/pprof" "strconv" sw "github.com/ESilva15/PTInvCertSWDB/sw" @@ -46,22 +44,19 @@ func get(c *gin.Context) { func count(c *gin.Context) { count := sw.Count() - c.JSON(http.StatusOK, gin.H{"count": count}) } func RunServer() error { - // go func() { - // http.ListenAndServe("localhost:6060", nil) - // }() - gin.SetMode(ginMode) router := gin.Default() authGroup := router.Group("/") - // authGroup.Use(APIAuthMiddleWare()) - authGroup.GET("/sw/:id", get) - authGroup.GET("/count", count) + authGroup.Use(APIAuthMiddleWare()) + { + authGroup.GET("/sw/:id", get) + authGroup.GET("/count", count) + } // Star the SW service err := sw.StartSWService(sw.FILEDB)