Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add custom routes to labelerServer.app #8

Open
mattbrailsford opened this issue Dec 10, 2024 · 2 comments
Open

Can't add custom routes to labelerServer.app #8

mattbrailsford opened this issue Dec 10, 2024 · 2 comments

Comments

@mattbrailsford
Copy link

mattbrailsford commented Dec 10, 2024

I'd like to add a custom route to the labelerServer.app instance such that I can respond to a webhook request to regenerate my label assignments, but whenever I try to add a route to the app, it just fails to start the labelerServer.

I've tried this as the most basic example

labelerServer.app.get("/my-custom-route", async (_req, res) => {
  // Logic should go here
  return res.send();
});

// Start the label server listener here

Should this be able to work? And am I doing something wrong?

@mattbrailsford
Copy link
Author

Hmm, looks like a timeout resolves this. I guess the websocket connection needs to come first and then the registrations, but given I initialize the route straight after creating the labeler server instance it's not finished waiting on the promise so I seem to need to wait a few ms before I can register routes

@mattbrailsford
Copy link
Author

Maybe it would be nice if we could pass a callback to the constructor to perform additional config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant