mirror of
https://github.com/rjNemo/go-pass-gen
synced 2026-06-06 02:46:40 +00:00
add start server method
This commit is contained in:
parent
e598ac2c09
commit
1458d55d32
4 changed files with 7 additions and 5 deletions
|
|
@ -32,3 +32,7 @@ func NewServer() *Server {
|
|||
func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
s.Router.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func (s Server) Start(port string) error {
|
||||
return http.ListenAndServe(port, s)
|
||||
}
|
||||
|
|
|
|||
2
client/package-lock.json
generated
2
client/package-lock.json
generated
|
|
@ -18,7 +18,7 @@
|
|||
"prettier": "^2.5.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "5.0.0",
|
||||
"react-scripts": "^5.0.0",
|
||||
"typescript": "^4.5.4",
|
||||
"web-vitals": "^2.1.3"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
"prettier": "^2.5.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "5.0.0",
|
||||
"react-scripts": "^5.0.0",
|
||||
"typescript": "^4.5.4",
|
||||
"web-vitals": "^2.1.3"
|
||||
},
|
||||
|
|
|
|||
4
main.go
4
main.go
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/rjNemo/go-pass-gen/api"
|
||||
"github.com/rjNemo/go-pass-gen/cmd"
|
||||
|
|
@ -25,6 +24,5 @@ func cli() {
|
|||
}
|
||||
|
||||
func serveWeb() {
|
||||
s := api.NewServer()
|
||||
log.Fatal(http.ListenAndServe(":8080", s))
|
||||
log.Fatal(api.NewServer().Start(":8080"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue