Custom Routing Protocols in Dancer - Play Nicely With JavaScript

Jeffrey Goff — 45 minutes 🐪

Simplify communicating between Dancer2 and your JavaScript front end by writing your own custom routing protocols. We’ll take Dancer2, DXtreme’s DataGrid, and your existing DBIx::Class schema, and combine them into a single route keyword you can use in your own apps.

At work I deal with DXtreme infinite-scrolling DXDataGrids and schedules on a regular basis. Regularly enough that I got tired of customizing the GET/POST/PUT/DELETE routes for every new DXDataGrid and created one customizable ‘dxtreme’ keyword that creates the basic routes for me, marshals and unmarshals DBIx::Class to/from JSON and performs the basic create, read, update and delete actions for me. Now when a front-end developer puts together a new DXDataGrid display, I can just add the plugin, customize the dxtreme keyword with the new DBIx::Class ResultSet and list of columns they want displayed, check it in and get back to work.

You’ll learn how to go beyond the basic ‘get’, ‘put’, ‘post’ and ‘DELETE’ keywords to create your own custom handlers for the huge variety of AJAX protocols, along with how to further customize your own route methods that go beyond the standard HTTP arguments, making it easy for your clients to create their own specialized route handlers.



Talk tags
Perl, Perl 5, DBIx::Class, Database, JavaScript, AJAX, DXtreme, NodeJS
Perl versions
🐪 Perl 5
Target audience
Intermediate
Category
Perl 5 programming
Talk duration
45 minutes
Talk status
accepted

Photo