serve public
This commit is contained in:
parent
410d0fc587
commit
8eabde60fd
9
main.go
9
main.go
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"gitlab.com/zephyrtronium/sq"
|
||||
@ -14,6 +15,11 @@ import (
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
var (
|
||||
addr = os.Getenv("SHOTGUN_HTTP")
|
||||
public = os.Getenv("SHOTGUN_PUBLIC")
|
||||
)
|
||||
|
||||
func main() {
|
||||
sessiondb, err := sq.Open("sqlite", ":memory:")
|
||||
if err != nil {
|
||||
@ -40,5 +46,6 @@ func main() {
|
||||
r.Post("/user/login", s.Login)
|
||||
r.With(serve.WithSession(sessions)).Get("/user/me", s.Me)
|
||||
r.With(serve.WithSession(sessions)).Get("/queue", s.Queue)
|
||||
http.ListenAndServe(":8080", r)
|
||||
r.Method("GET", "/", http.FileServer(http.Dir(public)))
|
||||
http.ListenAndServe(addr, r)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user