last accessed at!!!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"html/template"
|
||||
"log"
|
||||
@@ -78,6 +79,13 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
tracker := &AccessTracker{
|
||||
pending: make(map[string]int64),
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
go tracker.Run(ctx, db)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
fs := http.FileServer(http.Dir("static"))
|
||||
mux.Handle("GET /css/", fs)
|
||||
@@ -110,7 +118,7 @@ func main() {
|
||||
"Host": config.Host,
|
||||
})
|
||||
})
|
||||
mux.HandleFunc("GET /{id}", contentHandler(db, config))
|
||||
mux.HandleFunc("GET /{id}", contentHandler(db, config, tracker))
|
||||
mux.HandleFunc("POST /upload", uploadHandler(db, config, pages))
|
||||
mux.HandleFunc("PUT /upload", uploadHandler(db, config, pages))
|
||||
mux.HandleFunc("DELETE /{id}", deleteHandler(db, config))
|
||||
|
||||
Reference in New Issue
Block a user