Rapid API prototyping with Dancer and DBIx::Class

Screenshot of NAP Trending, a hack day project

Thursday and Friday last week were hack days here at NAP HQ, which is a time to work on anything you like, so long as it’s vaguely business related. The project I embarked on (see screenshot above) required an API and I thought this would be a good opportunity to use Dancer at work.

Dancer is a micro-framework inspired by the likes of Sinatra et. al. The primary goal is to provide developers with a simple DSL for handling HTTP requests:

#!/usr/bin/env perl
use Dancer;

get '/' => sub {
    "Hello World!"


This makes it well suited for rapidly prototyping APIs and other sorts of HTTP related applications.

Continue reading