Observable Server
Like Express but with observables
Usage
// ORconst createServer = const server = server
API
createServer
is the only export from this package. It is a function that takes an options
object and returns a ServerInterface
, both of which are defined below.
options
: The options for our serverport
: The port to listen onpre
: An HoF that will be givenRouteOptions
and return an rxjslettable
function to run before each route handler
ServerInterface
: The interface for our server streamon
: A function that, given aRouteOptions
shape, returns an observableRouteOptions
url
: An express-style url to match onmethod
: The HTTP method to listen on or'*'
orundefined
for all methods- Any other values that are expected by a
pre
for itsrouteOptions
Hof function.
For a full demo, check out ./demo.js
or after installing this locally, run npx nodemon demo.js
and send requests to the server.