For the last couple of days i've been working on a c++ version of the Sinatra web application framework, last night at Demo Dag Malmö i did a small demo of it so i might as well do a little write up too. So a "hello world" will look like this:
In this example we'll listen for requests on / and return the string "Hello world!". The syntax is inspired by Nancy.
Currently it supports Get request and can decode parameters if present. There's also a rough support for returning (html) files and for unknown routes a 404 will be returned.
To return the file index.html when a client requests /.
Most of the syntax is still in it's infancy, so it may very well change based on input and the never-ending quest to type less. For now it's self hosted using Boost.Asio but at some point it would be nice to be able to host it under nginx/apache via some kind of module. So to start any of the examples you simple call the run method with a port number that it should listen on.
Testing is done using the framework bandit, which is also a bit of inspiration for the project.
Frankie is up on github, for now I'm using issues in the repository to track stuff that needs to be done. Feel free to point and laugh and help me make it better. To build it you'll need boost installed and clang, at this point it's only tested on OSX 10.8 with clang 5.0 (llvm 3.3).