Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e67cc692ba | |||
|
|
445455f341 |
6 changed files with 17 additions and 5 deletions
12
README.md
Normal file
12
README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# ddServer
|
||||||
|
|
||||||
|
This is a simple Webserver, which helps zou creating monsters for a dungeons & dragons game
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
Either clone the repo and build it your self.
|
||||||
|
- You need to have go installed for that
|
||||||
|
|
||||||
|
Or download the latest release and start your server with
|
||||||
|
```bash
|
||||||
|
./ddServer
|
||||||
|
```
|
||||||
|
|
@ -25,7 +25,7 @@ func AboutHandler(content embed.FS) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the template with the provided data
|
// Execute the template with the provided data
|
||||||
data := map[string]interface{}{
|
data := map[string]any{
|
||||||
"Title": "Dungeons & Dragons Monster Generator",
|
"Title": "Dungeons & Dragons Monster Generator",
|
||||||
}
|
}
|
||||||
err = tmpl.ExecuteTemplate(w, "about", data)
|
err = tmpl.ExecuteTemplate(w, "about", data)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ func ContactHandler(content embed.FS) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the contact template
|
// Execute the contact template
|
||||||
err = tmpl.ExecuteTemplate(w, "contact", map[string]interface{}{
|
err = tmpl.ExecuteTemplate(w, "contact", map[string]any{
|
||||||
"Title": "Dungeons & Dragons Monster Generator",
|
"Title": "Dungeons & Dragons Monster Generator",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func FormHandler(content embed.FS, monsters *[]model.Monster) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the template and render the response.
|
// Execute the template and render the response.
|
||||||
data := map[string]interface{}{
|
data := map[string]any{
|
||||||
"Title": "Dungeons & Dragons Monster Generator",
|
"Title": "Dungeons & Dragons Monster Generator",
|
||||||
"Monsters": *monsters,
|
"Monsters": *monsters,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func MainHandler(content embed.FS, monsters *[]model.Monster) http.HandlerFunc {
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
|
||||||
// Execute the main template with the provided data
|
// Execute the main template with the provided data
|
||||||
err = tmpl.ExecuteTemplate(w, "main", map[string]interface{}{
|
err = tmpl.ExecuteTemplate(w, "main", map[string]any{
|
||||||
"Title": "Dungeons & Dragons Monster Generator",
|
"Title": "Dungeons & Dragons Monster Generator",
|
||||||
"Monsters": *monsters,
|
"Monsters": *monsters,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ func MonsterTableHandler(content embed.FS, monsters *[]model.Monster) http.Handl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the template and pass the necessary data
|
// Execute the template and pass the necessary data
|
||||||
err = tmpl.ExecuteTemplate(w, "monsterTable", map[string]interface{}{
|
err = tmpl.ExecuteTemplate(w, "monsterTable", map[string]any{
|
||||||
"Title": "Dungeons & Dragons Monster Generator",
|
"Title": "Dungeons & Dragons Monster Generator",
|
||||||
"Monsters": *monsters,
|
"Monsters": *monsters,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue