2024-09-13 03:03:39 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var SharedCache *Datastore
|
|
|
|
|
|
|
|
var routeMap = map[string]http.HandlerFunc{
|
|
|
|
"/": listContent,
|
|
|
|
"/about": about,
|
|
|
|
"/manage": manageContent,
|
|
|
|
"/ping": healthcheck,
|
|
|
|
}
|
|
|
|
|
2024-09-13 04:38:46 +00:00
|
|
|
var bgTasks = []BackgroundTask{
|
|
|
|
{refreshFeeds, 10 * time.Minute},
|
|
|
|
}
|
|
|
|
|
2024-09-13 03:03:39 +00:00
|
|
|
func main() {
|
|
|
|
SharedCache = &Datastore{
|
|
|
|
Data: map[string]string{},
|
|
|
|
}
|
|
|
|
|
|
|
|
if existingStore := FromFile("datastore.json"); existingStore != nil {
|
|
|
|
SharedCache = existingStore
|
|
|
|
}
|
|
|
|
|
2024-09-13 04:38:46 +00:00
|
|
|
NewApp(routeMap, bgTasks, "./static").Start(":9000")
|
2024-09-13 03:03:39 +00:00
|
|
|
}
|