feat: add ui and integrate with Go API server#31
Conversation
There was a problem hiding this comment.
If the main CLI daemon exits or gets a SIGINT/SIGTERM, the listener sockets might hang. Could we add a Shutdown(ctx) or Close() method to api.Server and trigger it in our cleanup/teardown sequence so that it shuts down gratefully ?
| "peerId": s.host.ID().String(), | ||
| "connectionCode": code, | ||
| "connectedPeers": len(peers), | ||
| "uptime": "0h", // TODO: Track uptime |
There was a problem hiding this comment.
We can store startTime time.Time on the Server struct when the server starts, and calculate the actual uptime here using time.Since(s.startTime) instead of hardcoding "0h". It's better to resolve this TODO before merging
| }); | ||
|
|
||
| // 2. Connect to SSE events | ||
| const sse = new EventSource('http://localhost:9001/api/events'); |
There was a problem hiding this comment.
Having http://localhost:9001 hardcoded here will break if the backend is started on a custom port via the --api-port flag.
Can we pull this from a Next.js environment variable (e.g., process.env.NEXT_PUBLIC_API_URL with a fallback to localhost:9001) so it is configurable?
Note: We'll also need to update the connect page where it fetches http://localhost:9001/api/connect.
5151e75 to
39ec4b8
Compare
No description provided.