mirror of
https://github.com/GrandpaNutz/fafda.git
synced 2026-03-11 22:15:35 +00:00
21 lines
419 B
Go
21 lines
419 B
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/spf13/afero"
|
|
|
|
"fafda/config"
|
|
)
|
|
|
|
func Serv(cfg config.HTTPServer, fs afero.Fs) error {
|
|
httpFs := afero.NewHttpFs(fs)
|
|
fileServer := http.FileServer(httpFs.Dir("/"))
|
|
http.Handle("/", fileServer)
|
|
log.Info().
|
|
Str("component", "httpserver").
|
|
Str("address", cfg.Addr).
|
|
Msg("starting server")
|
|
return http.ListenAndServe(cfg.Addr, nil)
|
|
}
|