migration into monorepo complete

This commit is contained in:
2023-01-27 22:26:17 -08:00
parent ec13f4416c
commit 6b918c4a57
8 changed files with 8 additions and 109 deletions

41
cmd/server/svg-server.go Normal file
View File

@@ -0,0 +1,41 @@
package main
import (
"math/rand"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/taigrr/gico/gitgraph/svg"
)
type DayCount [366]int
func init() {
rand.Seed(time.Now().UnixMilli())
}
func main() {
r := mux.NewRouter()
r.HandleFunc("/weekly.svg", func(w http.ResponseWriter, r *http.Request) {
freq := []int{}
for i := 0; i < 7; i++ {
freq = append(freq, rand.Int())
}
w.Header().Add("Content-Type", "text/html")
svg := svg.GetWeekSVG(freq)
svg.WriteTo(w)
})
r.HandleFunc("/yearly.svg", func(w http.ResponseWriter, r *http.Request) {
freq := []int{}
for i := 0; i < 365; i++ {
freq = append(freq, rand.Int())
}
svg := svg.GetYearSVG(freq)
w.Header().Add("Content-Type", "text/html")
svg.WriteTo(w)
})
http.ListenAndServe(":8080", r)
}