Serve files for static

This commit is contained in:
bel
2020-01-20 16:06:21 -07:00
parent 2bb3bee83c
commit 097ca9b8c0
5 changed files with 85 additions and 12 deletions

View File

@@ -2,12 +2,15 @@ package server
import (
"local/router"
"local/todo-server/config"
"local/todo-server/server/ajax"
"net/http"
)
type Server struct {
*ajax.Ajax
*router.Router
fileServer http.Handler
}
func New() *Server {
@@ -15,8 +18,10 @@ func New() *Server {
if err != nil {
panic(err)
}
fileServer := http.FileServer(http.Dir(config.Root))
return &Server{
Ajax: ajax,
Router: router.New(),
Ajax: ajax,
Router: router.New(),
fileServer: fileServer,
}
}