release of zero 0.1.0

Today we release a small project from me - zero 0.1.0.

It is aimed at being a toolkit for building web services. It is build around the idea of abstracting away what is tedious work and work with the information clearer. With that in mind, some modules are already included. These are the following.

Request

This class provides an interface to information regarding the request and making them available grouped together in other parts.

One example is the grouping of parameters in one attribute request.params which makes get and post parameters available separately. As many developers also regard URLs as some kind of parameters it is possible to define custom key/value pairs.

Another example is the grouping of all accept headers under #accept, which makes accessing type information nice to read: request.accept.types.

Response

The response class helps in building responses in a easy way. It provides similar interface as the Rack::Response. It also does a small check already for status code correctness and will probably get more helpers in the future to set common headers and status codes.

Router

Zero has a small router which takes routes and pushes the request to other applications. A similar implementation is Rack::URLMap, but this router is also able to extract variables from the URL and puts them into the Request.

Renderer

The renderer is a facility to render templates according to the accept type wanted by the client. That is possible by providing a map of short type names to the actual mimetypes which is then used internally to search for the right template. With this, developers have only to provide the template and mapping and then the rendering takes care of actually using it.

The router does not take care of the actual method of the request. This can be done before the router with a small application defining routers for every possible method or working with the method in the applications called by the routers.

Controller

This component is still a “Work in Progress” but can already be used to glue all these parts together. It splits the work into two steps - processing the request and rendering the resulting data. If that workflow does not fit, it is also possible to extend or modify the controller to adapt other work flows.

Status and Future of the toolset

The idea is to make web service development easier than before and this is only the beginning of zero. The plan is to extend the toolkit with more modules and make all modules possibly available as stand alone modules. That way, zero can be used in other projects to replace parts or help in making developing easier. It is a Work in Progress at the moment but the results so far are very promising.

We also have a repository for example applications and we will extend it with the time to show as many aspects of the toolkit as possible.

If you are interested, checkout zero on github or have a look at the examples.