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