Skip to content

v1.0.0-rc.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@JozefFlakus JozefFlakus released this 13 Aug 18:45
· 880 commits to master since this release

Breaking changes

  • Changed httpListener error handler attribute from errorMiddleware 👉 errorEffect. There was an inconsistency with previous error handler definition and naming. We had to correct this because error handler acts as an Effect instead of Middleware.

old bootstrapping API:

const app = httpListener({
  middlewares,
  effects,
  errorMiddleware,  👈
});

new bootstrapping API:

const app = httpListener({
  middlewares,
  effects,
  errorEffect,  👈
});

Whats new?

  • Exposed res.send method - from now you don't have to send response manually via dedicated Node.js http.OutgoingMessage API. The res.send method returns an empty stream, thus it can be easily composed inside middleware pipeline.
const middleware$: Middleware = (req$, res) =>
  req$.pipe(
    switchMap(() => res.send({ body: 💩, status: 304, headers: /* ... */ }),
  );
  • Exposed type aliases for common Marble.js architectural blocks:
const effect$: Effect = req$ =>
  req$.pipe(
    // ...
  );

const middleware$: Middleware = (req$, res) =>
  req$.pipe(
    // ...
  );

const error$: ErrorEffect = (req$, res, err) =>
  req$.pipe(
    // ...
  );