From de3a4a016e738aec9a4f2ffdaf9a73902d1f25fc Mon Sep 17 00:00:00 2001 From: pb Date: Thu, 26 Oct 2023 17:32:59 +0200 Subject: [PATCH] started implementing a /ping route --- controllers/default.go | 18 ++++++++++++++++++ routers/router.go | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 controllers/default.go diff --git a/controllers/default.go b/controllers/default.go new file mode 100644 index 0000000..ae1bb1b --- /dev/null +++ b/controllers/default.go @@ -0,0 +1,18 @@ +package controllers + +import ( + beego "github.com/beego/beego/v2/server/web" +) + +// MainController is in charge of the main page +type MainController struct { + beego.Controller +} + + + +// @Title logout +// @Description Logs out current logged in user session +// @Success 200 {string} logout success +// // @Security mySecurityPathNameApiKey +// @router /logout [get] diff --git a/routers/router.go b/routers/router.go index 3d04e6f..aa49005 100644 --- a/routers/router.go +++ b/routers/router.go @@ -81,7 +81,12 @@ func Init() { ), ) + // Namespace containing useful Path such as ping + + default_ns := beego.NewNamespace("/",beego.NSInclude(&controllers.MainController{})) + beego.AddNamespace(ns) + beego.AddNamespace(default_ns) beego.Get("/", func(ctx *context.Context) { ctx.Output.Body([]byte(services.DC_NAME))