31 lines
523 B
Go
31 lines
523 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
var SharedCache *Datastore
|
|
|
|
var routeMap = map[string]http.HandlerFunc{
|
|
"/": listContent,
|
|
"/about": about,
|
|
"/manage": manageContent,
|
|
"/ping": healthcheck,
|
|
}
|
|
|
|
var bgTasks = []BackgroundTask{
|
|
{refreshFeeds, 10 * time.Minute},
|
|
}
|
|
|
|
func main() {
|
|
SharedCache = &Datastore{
|
|
Data: map[string]string{},
|
|
}
|
|
|
|
if existingStore := FromFile("datastore.json"); existingStore != nil {
|
|
SharedCache = existingStore
|
|
}
|
|
|
|
NewApp(routeMap, bgTasks, "./static").Start(":9000")
|
|
}
|