I've a number of lightweight web apps using Express where I don't need to start two servers (one front end and the other frontend for the hub).
At least from reading the documentation I don't think I can have express start to use the Server started for the hub logic, so I ended up doing the following:
pubSubSubscriber.on("feed", data => console.log("feed", data));
pubSubSubscriber.on("subscribe", data => console.log("subscribe", data));
pubSubSubscriber.on("unsubscribe", data => console.log("unsubscribe", data));
pubSubSubscriber.on("error", data => console.log("error", data));
app.get("/pubsubhubbub", pubSubSubscriber._onGetRequest.bind(pubSubSubscriber));
app.post("/pubsubhubbub", pubSubSubscriber._onPostRequest.bind(pubSubSubscriber));
I'm reaching right in to the private functions which doesn't smell right to me and is very brittle.
I would love to see a cleaner solution to at least exposing the get and post methods so that I can manage them without starting a server just for the pubsub functionality.
I've a number of lightweight web apps using Express where I don't need to start two servers (one front end and the other frontend for the hub).
At least from reading the documentation I don't think I can have express start to use the Server started for the hub logic, so I ended up doing the following:
I'm reaching right in to the private functions which doesn't smell right to me and is very brittle.
I would love to see a cleaner solution to at least exposing the
get
andpost
methods so that I can manage them without starting a server just for the pubsub functionality.