# Examples

We start with a simple helloworld example, than add a bit more modularity in server time. Before we proceed with examples below let setup virtualenv environment:

$virtualenv env$ env/bin/easy_install wheezy.routing


## Hello World

helloworld.py shows you how to use :ref:wheezy.routing in pretty a simple WSGI application:

Let have a look through each line in this application. First of all we import :py:class:~wheezy.routing.PathRouter that is actually just an exporting name for :py:class:~wheezy.routing.router.PathRouter:

Next we create a pretty simple WSGI handler to provide a response.

main function serves as WSGI application entry point. The only thing we do here is to get a value of WSGI environment variable PATH_INFO (the remainder of the request URL's path) and pass to router :py:meth:~wheezy.routing.router.PathRouter.match method, in return we get handler and kwargs (parameters discovered from matching rule, that we ignore for now).