Im following through a Go book(https://lets-go.alexedwards.net/).
Im trying to undesteand the necessity of a FileServer to serve html, css, js and image files.
These files are stored in my project structure.
I have a bumch of Go tmpl files, one of them can access these static files without need of FileServer.
// ROUTES.GO
fileServer := http.FileServer(http.Dir("./ui/static/"))
mux.Handle("/static/", http.StripPrefix("/static", fileServer))
mux.HandleFunc("/", app.home)
// BASE.TMPL
{{define "base"}}
<!doctype html>
<html lang='en'>
<head>
<!-- Link to the CSS stylesheet and favicon -->
<link rel='stylesheet' href='/static/css/main.css'>
<link rel='shortcut icon' href='/static/img/favicon.ico' type='image/x-icon'>
</head>
<body>
<!-- And include the JavaScript file -->
<script src="/static/js/main.js" type="text/javascript"></script>
</body>
</html>
{{end}}
I want to know the necessity of a FileServer.