Commit da00e7c8 authored by Jae's avatar Jae
Browse files

Add base of webring

parent 13ee0054
# A small demo of Markdown
## Tables
Name | Age
--------|------
Bob | 27
Alice | 23
Jae | 20
## Syntax Highlight
```go
func getTrue() bool {
return true
}
```
## Definitions
Cat
: Fluffy animal everyone likes
Internet
: Vector of transmission for pictures of cats
## Footnotes
This is a footnote.[^1]
[^1]: the footnote text.
## Fractions
<sup>4</sup>&frasl;<sub>5</sub>
......@@ -16,6 +16,17 @@ type Post struct {
Content template.HTML
}
// For the future
type Website struct {
Name string `json:"name"`
Url string `json:"url"`
Owner string `json:"owner"`
}
type Members struct {
Members []Website `json:"members"`
}
func main() {
// Web service
r := gin.Default()
......@@ -48,6 +59,17 @@ func main() {
})
})
r.GET("/webring/members", func(c *gin.Context) {
jsonfile, err := ioutil.ReadFile("./webring/members.json")
if err != nil {
c.JSON(500, gin.H{
"error": "Failed to read members",
})
return
}
c.Data(http.StatusOK, "application/json", jsonfile)
})
r.LoadHTMLGlob("templates/**/*.tmpl")
r.Static("/assets", "./static")
......
{
"members": [
{
"name": "Jae's Website",
"url": "https://jae.fi",
"owner": "Jae Lo Presti"
},
{
"name": "Dummy",
"url": "https://example.tld",
"owner": "John code"
}
]
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment