basic server/client http communication setup
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
package engine
|
||||
|
||||
import "github.com/labstack/echo"
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
func (server *GVCServer) Info(context echo.Context) {
|
||||
"github.com/labstack/echo"
|
||||
)
|
||||
|
||||
// GetInfo return the relevant repo specific info to the client
|
||||
func (Server *GVCServer) GetInfo(context echo.Context) error {
|
||||
repo := context.Param("repoName")
|
||||
return context.JSON(http.StatusAccepted, repo)
|
||||
}
|
||||
|
||||
// Hello just verifies the server is running //TODO remove this, just extra shit we are sending
|
||||
func (Server *GVCServer) Hello(context echo.Context) error {
|
||||
helloMsg := "server alive"
|
||||
return context.JSON(http.StatusOK, helloMsg)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ func main() {
|
||||
log.Info("Logger starting...")
|
||||
// Setup the web server
|
||||
e := echo.New()
|
||||
|
||||
server.Echo = e
|
||||
//Start the routes
|
||||
//server.Echo.GET("/info")
|
||||
e.GET("/hello", server.Hello)
|
||||
e.GET("/info/:repoName", server.GetInfo)
|
||||
e.Logger.Fatal(e.Start(fmt.Sprintf("%s:%d", server.Config.BindIP, server.Config.Port)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user