chore: configure cors and simplify template
This commit is contained in:
parent
a376800eeb
commit
416a93d6a0
8
main.go
8
main.go
|
@ -93,7 +93,13 @@ func main() {
|
|||
|
||||
// CORS configuration
|
||||
corsConfig := cors.DefaultConfig()
|
||||
corsConfig.AllowOrigins = []string{"*"}
|
||||
corsConfig.AllowOrigins = []string{"https://log101.dev"}
|
||||
|
||||
ginMode := gin.Mode()
|
||||
if ginMode == gin.DebugMode {
|
||||
corsConfig.AllowOrigins = append(corsConfig.AllowOrigins, "http://localhost:4321")
|
||||
}
|
||||
|
||||
corsConfig.AllowHeaders = []string{"hx-current-url", "hx-request"}
|
||||
r.Use(cors.New(corsConfig))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form hx-post="http://localhost:8000/forms/emoji/post" hx-swap="outerHTML">
|
||||
<form hx-post="/blog/api/forms/emoji/post" hx-swap="outerHTML">
|
||||
<input type="hidden" name="postId" value="{{.postId}}">
|
||||
<div class="emoji-buttons-container">
|
||||
{{ range .results }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user