-
Notifications
You must be signed in to change notification settings - Fork 39
Hello,
I am trying to embed riverui is my own web app, I have followed the directions on the web site. On my local dev machine, I use localhost port 4000 and am using the riverui prefix, But when I try to access the ui at localhost:4000/riverui, it returns a 404 error. I've tried to solve the problem myself, but am now stuck. Appreciate any help.
Thanks
All reactions
Replies: 2 comments 1 reply
Hi, is there any way you can share a full code sample? There's nothing to really go on here to be able to help.
All reactions
Yes, I guess that isn't much help. I closely followed the documentation. Here is the initialiization:
// river ui
opts := &riverui.ServerOpts{
Client: riverClient,
DB: db,
Logger: logger,
Prefix: "/riverui", // mount the UI and its APIs under /riverui
}
riverServer, err := riverui.NewServer(opts)
if err != nil {
log.Fatal(err)
}
// Start the server to initialize background processes for caching and periodic queries:
if err := riverServer.Start(ctx); err != nil {
log.Fatal(err)
}
I assign the server to a variable on my application struct like so:
app.riverServer: riverServer
Then I added the routes:
mux.Handle("/riverui", app.riverServer)
The only thing I do different than the documentation is the assignment of the riverServer to my app struct.
Sorry to be so unhelpful before.
Cheers,
Rod
All reactions
Can you check the runnable example in #334? I suspect you'll find something different between its setup and yours.