mirror of
https://github.com/speatzle/nfsense.git
synced 2025-09-13 15:19:08 +00:00
Manage API Method Registration from main
This commit is contained in:
parent
c3d5e3edc1
commit
be852d0655
5 changed files with 22 additions and 39 deletions
10
cmd/api.go
Normal file
10
cmd/api.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"nfsense.net/nfsense/pkg/definitions"
|
||||
"nfsense.net/nfsense/pkg/jsonrpc"
|
||||
)
|
||||
|
||||
func RegisterAPIMethods(apiHandler *jsonrpc.Handler, conf *definitions.Config) {
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
"nfsense.net/nfsense/pkg/jsonrpc"
|
||||
"nfsense.net/nfsense/pkg/server"
|
||||
)
|
||||
|
||||
|
@ -37,8 +38,12 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
slog.Info("Setup API...")
|
||||
apiHandler := jsonrpc.NewHandler(100 << 20)
|
||||
RegisterAPIMethods(apiHandler, conf)
|
||||
|
||||
slog.Info("Starting Webserver...")
|
||||
server.StartWebserver(conf)
|
||||
server.StartWebserver(conf, apiHandler)
|
||||
|
||||
slog.Info("Ready")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue