Skip to content

v0.1.3-alpha

Pre-release
Pre-release
Compare
Choose a tag to compare
@arteymix arteymix released this 12 Jun 00:18
· 866 commits to master since this release

This release brings a couple of bugfixes, support for more status codes and the possibility to pass state in the next continuation.

More tests have been written and the coverage has reached 58.42%.

The release can be verified against this SHA-1 checksum: 60ea76b69569eab0e4670dbdaa3e70ca32f2db45

Changeset

  • fix the null rule to match the empty path
  • informational and success status codes
  • pass a state in the next continuation
  • use the state to pass the error message for status handlers

Informational and success status codes

It is now possible to throw Informational and Success status codes from these two error domains. They can be used to perform automated handling for created resources (201) or protocol switch (101).

Valum will try to support every standardized status codes, so if anything seems to be missing, open an issue or submit a pull request with the required changes.

State in the next continuation

Data can be passed when invoking the next continuation:

app.all (null, (req, res, next) => {
    next ("message for the next handler");
});

app.get ("", (req, res, next, state) => {
    string message = state; // implicit conversion, state is a Value?
});

This approach is used to pass the error message to a status handler and can be generally used to pass the result of a computation to the next handler.