Skip to content

Releases: valum-framework/valum

v0.1.2-alpha

06 Jun 18:25
Compare
Choose a tag to compare
v0.1.2-alpha Pre-release
Pre-release

This is probably the last release of the 0.1 series as the 0.2 branch is almost ready to be merged in the trunk.

This release introduce fixes and two features: null rules and status code handling.

You can verify the release against this SHA-1 checksum: c564e37ff1934470669789853b9db04d4ae6d8b0

Changeset

  • avoids a useless traversal when constructing the Accept header
  • suffixes callback delegates with Callback
  • status handling
  • null can be used as a rule to catch all possible paths
  • uses 0 as a default file descriptor for FastCGI
  • uses add_main_options_entries for compatibility with GIO (>=2.40)

Status handling

The feature was initially planned for the 0.2 minor release, but it could be easily merged in master. It provides new helpers on the Router to handle thrown status codes.

app.status (404, (req, res) => {
    // handle a 404 error...
});

The null rule

Using null as a rule will match all possible request paths so that it can be conveniently used to create catch-all routes.

app.get (null, (req, res) => {
    res.write ("Hello world!".data);
});

Combined with all, it provides a simple mechanism to build middlewares.

v0.1.1-alpha

29 May 20:51
Compare
Choose a tag to compare
v0.1.1-alpha Pre-release
Pre-release

This relese bring backports from 0.2.*, bugfixe, minor features and documentation improvments.

It is still an alpha release and API breaks are expected for the next release. The final specifications is almost completed and should be stable in a few weeks.

The coverage passed from 53.04% to 55.19%, this is a 2.15% increase since the last release!

You can verify the release against this SHA1 checksum: fff3585e15c02cd44d963ce5a617f89c42f69133

Changeset

  • renames splice to stream in View
  • removes splice_async from View
  • honors https scheme in FastCGI if HTTPS environment variable is set
  • provides HTTPVersion in Request
  • removes handle_async from Application
  • fixes threading option and adds --enable-threading configuration option
  • implements a next continuation to keep routing
  • fixes the reference to the handler in Route
  • provides capability to bind a callback to multiple and all HTTP methods at once

Bind callback to multiple or all HTTP methods

Callback can be bound to multiple HTTP methods at once with methods:

app.methods ({Request.GET, Request.POST}, "", (req, res, next) => {
    // ...
});

Or all of them at once:

app.all ("", (req, res, next) => {
    // ...
});

Next

It is now possible to keep routing with a continuation in a Route.Handler.

app.get ("", (req, res, next) => {
    next ();
});

app.get ("", (req, res) => {
   // matched!
});

Outside the removal of the setup signal, this change is completely backward-compatible and bring a wide range of new possibilities.

The signal was removed since it can be implemented using a catch-all route that just simply call next.

router.all ("<any:path>", (req, res, next) => {
    next ();
});

Remove async code

The async code in this release is not ready and will be deeply modified in 0.2.*, so it is better for now not to go forward and keep a synchronous model.

v0.1.0-alpha: Merge pull request #73 from valum-framework/0.1/server-documentation

27 May 16:44
Compare
Choose a tag to compare

This release is the second release of Valum. It is a pre-release since we are still prototyping most of the features and we need feedback and ideas to create the very best Vala web micro-framework.

You can very the release against this SHA1: eceadafe08bbbf52cefeda2ae240825b92223708

Changeset

Most of these changes are breaking the initial API as there was a great step between the initial framework and something designed to support any web protocol.

Route and Router improvments

The new variable system for rules is more powerful as it is now possible to type parameters:

app.get("user/<int:id>", (req, res) => {
    var id = req.params["id"];
});

app.get ("<any:anything>", (req, res) => {
    // catches /.+/
});

The Route class is more flexible and support literal regular expression that are automatically scoped and anchored with ^ and $.

app.regex (Request.GET, /home/, (req, res) => {
    var writer = new DataOutputStream (res);
    writer.put_string ("Matched using a Regex!");
});

Route have been reimplemented upon a matcher callback. This make the routing system is therefore much more powerful.

app.matcher (Request.GET, (req) => { return true; }, (req, res) => {
    // catch-all route
});

VSGI

VSGI is a set of abstractions and implementations that aims a compatibility with all existing HTTP. It's heavily based on libsoup-2.4, an library implementing the HTTP protocol.

  • Request and Response inherit from InputStream and OutputStream respectively
  • Request provide HTTP methods constants
  • headers based on Soup.MessageHeaders
  • uri based on Soup.URI that provides access to path and HTTP query
  • basic cookies handling

All implementations are stored un a subnamespace VSGI.* and respect a common interface. It is possible to switch the used server technology with a using statement.

using VSGI.FastCGI;
using VSGI.Soup;

The server implementation has been based on GLib.Application, providing a great host integration and many useful capabilities:

  • a MainLoop for processing events and asynchronous work
  • DBus integration
  • capability to handle CLI arguments
  • optional timeout feature to exit automatically if no requests are received after a certain delay

If the server takes the CLI arguments, it can be parametrized very nicely:

using Valum;
using VSGI.Soup;

public static int main (string[] args) {
    var app = new Router ();

    return new Server (app).run (args);
}

Code coverage

The framework is released with an overall coverage of 53%.

The coverage for the most important components of the framework (Router, Route, View) is very good, but there is almost nothing for VSGI implementations.

Documentation

Big loads of efforts were put on producing a quality user documentation. It is written in reStructuredText and generated by Sphinx.

You can consult the documentation on ReadTheDocs: http://valum-framework.readthedocs.org/en/latest/

It covers the whole framework, VSGI and provide guidelines and approach to deal with common web development issues.

v0.0.1

02 May 14:44
Compare
Choose a tag to compare
v0.0.1 Pre-release
Pre-release
Note about V8 integration