Create public static files to serve
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"local/cheqbooq/config"
|
||||
"local/cheqbooq/server/account"
|
||||
"local/cheqbooq/server/balance"
|
||||
"local/cheqbooq/server/transaction"
|
||||
"local/router"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -12,6 +15,7 @@ func (s *Server) Routes() error {
|
||||
"api/v1/balance": s.balance1,
|
||||
"api/v1/transaction": s.transaction1,
|
||||
"api/v1/account": s.account1,
|
||||
fmt.Sprintf("%s%s", router.Wildcard, router.Wildcard): s.public,
|
||||
}
|
||||
for path, handler := range routes {
|
||||
if err := s.Add(path, handler); err != nil {
|
||||
@@ -51,3 +55,8 @@ func (s *Server) account1(w http.ResponseWriter, r *http.Request) {
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) public(w http.ResponseWriter, r *http.Request) {
|
||||
d := http.FileServer(http.Dir(config.Public))
|
||||
d.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user