mirror of
https://github.com/rjNemo/go-pass-gen
synced 2026-06-12 13:46:49 +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) {
|
func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
s.Router.ServeHTTP(w, r)
|
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",
|
"prettier": "^2.5.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "^5.0.0",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"web-vitals": "^2.1.3"
|
"web-vitals": "^2.1.3"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "^5.0.0",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"web-vitals": "^2.1.3"
|
"web-vitals": "^2.1.3"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
4
main.go
4
main.go
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/rjNemo/go-pass-gen/api"
|
"github.com/rjNemo/go-pass-gen/api"
|
||||||
"github.com/rjNemo/go-pass-gen/cmd"
|
"github.com/rjNemo/go-pass-gen/cmd"
|
||||||
|
|
@ -25,6 +24,5 @@ func cli() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func serveWeb() {
|
func serveWeb() {
|
||||||
s := api.NewServer()
|
log.Fatal(api.NewServer().Start(":8080"))
|
||||||
log.Fatal(http.ListenAndServe(":8080", s))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue