Barebones HTTP server setup
This commit is contained in:
24
server.go
Normal file
24
server.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"projectreshoot/middleware"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Host string
|
||||
Port string
|
||||
}
|
||||
|
||||
func NewServer(
|
||||
config *Config,
|
||||
) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
addRoutes(
|
||||
mux,
|
||||
*config,
|
||||
)
|
||||
var handler http.Handler = mux
|
||||
handler = middleware.Logging(handler)
|
||||
return handler
|
||||
}
|
||||
Reference in New Issue
Block a user