Changed the data types to be able to hold a companys NIF
This commit is contained in:
+12
-1
@@ -2,9 +2,9 @@
|
||||
package api
|
||||
|
||||
// TODO: configure the logging
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
// _ "net/http/pprof"
|
||||
"strconv"
|
||||
|
||||
sw "github.com/ESilva15/PTInvCertSWDB/sw"
|
||||
@@ -44,13 +44,24 @@ func get(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, sw)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
// Star the SW service
|
||||
err := sw.StartSWService(sw.FILEDB)
|
||||
|
||||
Reference in New Issue
Block a user