This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"smt/models"
|
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"smt/models"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@@ -23,7 +23,7 @@ func StoreSecret(c *gin.Context) {
|
|||||||
var input StoreInput
|
var input StoreInput
|
||||||
|
|
||||||
if err := c.ShouldBindJSON(&input); err != nil {
|
if err := c.ShouldBindJSON(&input); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid JSON received : " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
main.go
12
main.go
@@ -1,10 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"smt/controllers"
|
|
||||||
"smt/middlewares"
|
|
||||||
"smt/models"
|
|
||||||
"smt/utils"
|
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -12,6 +8,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"smt/controllers"
|
||||||
|
"smt/middlewares"
|
||||||
|
"smt/models"
|
||||||
|
"smt/utils"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -147,8 +147,8 @@ func main() {
|
|||||||
// Get secrets
|
// Get secrets
|
||||||
protected := router.Group("/api/secret")
|
protected := router.Group("/api/secret")
|
||||||
protected.Use(middlewares.JwtAuthMiddleware())
|
protected.Use(middlewares.JwtAuthMiddleware())
|
||||||
protected.GET("/retrieve", controllers.RetrieveSecret)
|
protected.POST("/retrieve", controllers.RetrieveSecret)
|
||||||
protected.GET("/retrieveMultiple", controllers.RetrieveMultpleSecrets)
|
protected.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets)
|
||||||
protected.POST("/store", controllers.StoreSecret)
|
protected.POST("/store", controllers.StoreSecret)
|
||||||
protected.POST("/update", controllers.UpdateSecret)
|
protected.POST("/update", controllers.UpdateSecret)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user