Skip to content
Snippets Groups Projects
Commit ea5fa2df authored by Marvin Berstecher's avatar Marvin Berstecher
Browse files

add new controller for connections

parent cea69931
No related branches found
No related tags found
No related merge requests found
package controllers
package controller
import (
"fmt"
"net/http"
"github.com/gin-gonic/gin"
......@@ -13,21 +14,35 @@ func (cc ConnectionController) CreateConnectionEndpoint(context *gin.Context) {
}
func (cc ConnectionController) UpdateConnection(context *gin.Context) {
did := context.Param("did")
fmt.Println("Given DID: " + did)
context.Status(http.StatusNotImplemented)
}
func (cc ConnectionController) DeleteConnection(context *gin.Context) {
did := context.Param("did")
fmt.Println("Given DID: " + did)
context.Status(http.StatusNotImplemented)
}
func (cc ConnectionController) ConnectionInformation(context *gin.Context) {
did := context.Param("did")
fmt.Println("Given DID: " + did)
context.Status(http.StatusNotImplemented)
}
func (cc ConnectionController) ConnectionStatus(context *gin.Context) {
did := context.Param("did")
fmt.Println("Given DID: " + did)
context.Status(http.StatusNotImplemented)
}
func (cc ConnectionController) BlockConnection(context *gin.Context) {
did := context.Param("did")
fmt.Println("Given DID: " + did)
context.Status(http.StatusNotImplemented)
}
func (cc ConnectionController) ListConnections(context *gin.Context) {
context.Status(http.StatusNotImplemented)
}
package controllers
package controller
import (
"net/http"
......
package server
import (
controllers "gaiax/didcommconnector/controller"
"gaiax/didcommconnector/controller"
"github.com/gin-gonic/gin"
)
......@@ -11,17 +11,18 @@ func NewRouter() *gin.Engine {
router.Use(gin.Logger())
// hello world
helloWorld := new(controllers.HelloWorldController)
helloWorld := new(controller.HelloWorldController)
router.GET("/helloworld", helloWorld.HelloWorld)
// connection
cc := new(controllers.ConnectionController)
router.PUT("/connection", cc.CreateConnectionEndpoint)
router.PATCH("/connection", cc.UpdateConnection)
router.DELETE("/connection", cc.DeleteConnection)
router.GET("/connection", cc.ConnectionInformation)
router.GET("/connection/status", cc.ConnectionStatus)
router.PUT("/connection/block", cc.BlockConnection)
cc := new(controller.ConnectionController)
router.PUT("/connections", cc.CreateConnectionEndpoint)
router.PATCH("/connections/:did", cc.UpdateConnection)
router.DELETE("/connections/:did", cc.DeleteConnection)
router.GET("/connections/:did", cc.ConnectionInformation)
router.GET("/connections", cc.ListConnections)
router.GET("/connections/status/:did", cc.ConnectionStatus)
router.PUT("/connections/block/:did", cc.BlockConnection)
// TODO: add other controllers to the router
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment