41 lines
927 B
Go
41 lines
927 B
Go
package main
|
|
|
|
import "log"
|
|
|
|
type Blog struct {
|
|
Id string `json:"id"`
|
|
Content string `json:"content"`
|
|
Date string `json:"created_at"`
|
|
Author Account `json:"account"`
|
|
}
|
|
|
|
type Config struct {
|
|
Listen string `json:"listen"`
|
|
CertPath string `json:"cert_path"`
|
|
KeyPath string `json:"key_path"`
|
|
BaseURL string `json:"base_url"`
|
|
Title string `json:"title"`
|
|
HomeMessage string `json:"home_message"`
|
|
}
|
|
|
|
type Account struct {
|
|
Id string `json:"id"`
|
|
Name string `json:"display_name"`
|
|
Url string `json:"url"`
|
|
}
|
|
|
|
type Thread struct {
|
|
Ancestors []Blog `json:"ancestors"`
|
|
Descendants []Blog `json:"descendants"`
|
|
}
|
|
|
|
func main() {
|
|
config := getConfig()
|
|
|
|
listener := listen(config.Listen, config.CertPath, config.KeyPath)
|
|
log.Println("Server successfully started")
|
|
log.Println("Server is listening at " + config.Listen)
|
|
|
|
serve(listener, config.BaseURL, config.Title, config.HomeMessage)
|
|
}
|