Skip to content

Commit

Permalink
make sure api calls are not cached in the desktop app.
Browse files Browse the repository at this point in the history
fixes #270
  • Loading branch information
AnalogJ committed Oct 9, 2023
1 parent dcabfc8 commit c1f057a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/pkg/web/middleware/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package middleware

import "github.com/gin-gonic/gin"

func CacheMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
c.Writer.Header().Set("Cache-Control", "no-cache")
c.Writer.Header().Set("Pragma", "no-cache")
c.Next()
}
}
1 change: 1 addition & 0 deletions backend/pkg/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (ae *AppEngine) Setup() (*gin.RouterGroup, *gin.Engine) {
{
api := base.Group("/api")
{
api.Use(middleware.CacheMiddleware())
api.GET("/health", func(c *gin.Context) {
//TODO:
// check if the /web folder is populated.
Expand Down

0 comments on commit c1f057a

Please sign in to comment.