senecajs / seneca-transport

Seneca micro-services message transport over TCP and HTTP.
MIT License
63 stars 45 forks source link

access to http server instance #127

Open afoninsky opened 8 years ago

afoninsky commented 8 years ago

Server instance created in local scope, not accessible by my code: https://github.com/senecajs/seneca-transport/blob/master/lib/http.js#L23

Can we extend http server (or append ability to pass it via config, or do whatever else according your module rules)?

Usecase: i want to pass socket into my favorite http framework (express/hapi/koa) and setup health-check routes (example for google: "GET /_ah/health" tells google what my microservice is alive)

mcdonnelldean commented 8 years ago

@afoninsky We'd definitely be open to a PR on this. seneca.export can be used to cleanly export named functions and objects from plugins; see: https://github.com/senecajs/seneca/blob/master/test/plugin.test.js#L32

benbonnet commented 7 years ago

not that experienced yet to extending seneca; but interested in this feature (providing health check for the service); what would be the simplest approach (two url would be needed) ?

vladholubiev commented 7 years ago

Same question as @bbnnt , is what is the recommended way for health check? Just seneca.add(role: health, cmd: check) or does seneca have something built-in already @mcdonnelldean ?

vladholubiev commented 7 years ago

@bbnnt I looked at the sources, and found you can call /act?role=seneca&cmd=stats to do a health check