diff --git a/lib/controllers/controllers_header.go b/lib/controllers/controllers_header.go new file mode 100644 index 0000000..4869417 --- /dev/null +++ b/lib/controllers/controllers_header.go @@ -0,0 +1,15 @@ +package controllers + +import "github.com/gin-gonic/gin" + +func ApplyHeaders(router *gin.Engine) { + + router.Use(func(ctx *gin.Context) { + // Apply the header + ctx.Header("FreePad-Version", "1.1.0") + + // Move on + ctx.Next() + }) + +} diff --git a/main.go b/main.go index 908ff66..9cdb23e 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,9 @@ func main() { // Initialize the router router := gin.Default() + // Apply the FreePad Headers + controllers.ApplyHeaders(router) + // Read HTML Templates router.LoadHTMLGlob("templates/**/*.html")