Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public methods and /ping endpoint #127

Merged
merged 1 commit into from
Aug 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func Start(cfg config.ApiConfig) {
attachRoot(r)
attachServers(r)

/* attach endpoints with no auth */
p := app.Group("/")
attachPublic(p)

var err error
/* start rest api server */
if cfg.Tls != nil {
Expand Down
24 changes: 24 additions & 0 deletions src/api/public.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* public.go - / rest api implementation
*
* @author Mike Schroeder <m.schroeder223@gmail.com>
*/
package api

import (
"github.com/gin-gonic/gin"
"net/http"
)

/**
* Attaches / handlers
*/
func attachPublic(app *gin.RouterGroup) {

/**
* Simple 200 and OK response
*/
app.GET("/ping", func(c *gin.Context) {
c.String(http.StatusOK, "OK")
})
}