Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: add cors middleware

Steven6d45616dbe50
diff --git a/server/server.go b/server/server.go
index 2cbf5490d..ddd66c4e9 100644
--- a/server/server.go
+++ b/server/server.go
@@ -66,6 +66,12 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
e.Use(middleware.Gzip())
+ e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
+ Skipper: grpcRequestSkipper,
+ AllowOrigins: []string{"*"},
+ AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete},
+ }))
+
e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
Skipper: grpcRequestSkipper,
Timeout: 30 * time.Second,