SlideShare a Scribd company logo
The peanut butter cup of web-dev:
Plack & single page web apps
@genehack ≈ 03 May 2014 ≈ DCBPW v3.0
John SJ Anderson
@genehack
Director of Technology!
Infinity Interactive
Single-page applications
• All "static" assets delivered in single page load
• Page does not do full reload cycle during usage
• May have backend returning JSON in response to
user actions
• Client-side Javascript code handles UI updates
…many options
Angular.js
• Client-side MVC Javascript framework
• Developed at Google
• "HTML enhanced"
• Great for "single page" web apps
Easy to get started with Angular
<!DOCTYPE html>
<html>
<head>
<title>Two Way Data Binding Demo</title>
<script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script>
<script type="text/javascript">
function demoCtrl ($scope) {
$scope.demoValue = "foo"
}
</script>
</head>
<body ng-app>
<div ng-controller="demoCtrl">
<h1>{{demoValue}}</h1>
<input type="text" ng-model="demoValue" />
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Two Way Data Binding Demo</title>
<script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script>
<script type="text/javascript">
function demoCtrl ($scope) {
$scope.demoValue = "foo"
}
</script>
</head>
<body ng-app>
<div ng-controller="demoCtrl">
<h1>{{demoValue}}</h1>
<input type="text" ng-model="demoValue" />
</div>
</body>
</html>
Easy to get started with Angular
Load angular library
<!DOCTYPE html>
<html>
<head>
<title>Two Way Data Binding Demo</title>
<script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script>
<script type="text/javascript">
function demoCtrl ($scope) {
$scope.demoValue = "foo"
}
</script>
</head>
<body ng-app>
<div ng-controller="demoCtrl">
<h1>{{demoValue}}</h1>
<input type="text" ng-model="demoValue" />
</div>
</body>
</html>
Easy to get started with Angular
Bootstrap Angular
<!DOCTYPE html>
<html>
<head>
<title>Two Way Data Binding Demo</title>
<script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script>
<script type="text/javascript">
function demoCtrl ($scope) {
$scope.demoValue = "foo"
}
</script>
</head>
<body ng-app>
<div ng-controller="demoCtrl">
<h1>{{demoValue}}</h1>
<input type="text" ng-model="demoValue" />
</div>
</body>
</html>
Easy to get started with Angular
Tie this <div> to this 

chunk of controller code

(which means

'demoValue' is available)
<!DOCTYPE html>
<html>
<head>
<title>Two Way Data Binding Demo</title>
<script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script>
<script type="text/javascript">
function demoCtrl ($scope) {
$scope.demoValue = "foo"
}
</script>
</head>
<body ng-app>
<div ng-controller="demoCtrl">
<h1>{{demoValue}}</h1>
<input type="text" ng-model="demoValue" />
</div>
</body>
</html>
Easy to get started with Angular
Angular template – replaced

with value of demoValue
Data binding – 

changing input 

changes value 

of demoValue
Ill-advised
live demo time!
So, it's…
But then…
You hit a brick wall.
You need
a server.
[ A noble yak enters from stage left. ]
Javascript tools
• express
• node.js
• grunt
• yeoman
• bower
• npm
Wait … I know Perl.
Perl can serve files.
plackfile
#!/usr/bin/env perl
!
use Plack::Runner;
!
my $app = Plack::App::IndexFile->new({ root => shift })->to_app;
my $runner = Plack::Runner->new;
$runner->parse_options( '--access-log' => '/dev/null', @ARGV );
$runner->run( $app );
!
package Plack::App::IndexFile;
use parent 'Plack::App::File';
sub locate_file {
my( $self, $env ) = @_;
my $path = $env->{PATH_INFO} || '';
!
return $self->SUPER::locate_file( $env )
unless $path && $path =~ m{/$};
!
$env->{PATH_INFO} .= 'index.html';
!
return $self->SUPER::locate_file( $env );
}
Easy to grow that simple server…
into a full Plack-based application.
Prototyping with Plack
• Static file serving
• Middleware for session management
• Authentication via middleware
• Prototype your backend API (using OX or Dancer)
• Possible to merge "typical" JS app layout and
"typical" Perl module layout without conflicts
Probably not appropriate for production…
…but you can't live on just Reese's either.
It is a fun easy way to started.
Allows you to learn one new thing without having to
learn a dozen new things at the same time.
X
Anti-yak pattern
Photo credits
• All photos either by me or CC-BY-SA; attributions below
• Slide #1: https://www.flickr.com/photos/nettsu/4570198529
• Slide #4: https://www.flickr.com/photos/aprily/4196214910
• Slide #11: https://www.flickr.com/photos/quinnanya/3821453576
• Slide #12: https://www.flickr.com/photos/sarahseverson/6367143975
• Slide #14: https://www.flickr.com/photos/mvallius/10104902114
• Slide #15: https://www.flickr.com/photos/torkildr/3462607995
• Slide #16 & #26: https://www.flickr.com/photos/archer10/2661318228
• Slide #18: https://www.flickr.com/photos/eole/4407750708
• Slide #19: https://www.flickr.com/photos/kef08/2988576699
• Slide #20: https://www.flickr.com/photos/worldofoddy/146446352
• Slide #21: code from http://www.modernperlbooks.com/mt/2011/08/serving-a-local-directory-with-plack.html
• Slide #22: https://www.flickr.com/photos/62172402@N07/9924983085
• Slide #24: https://www.flickr.com/photos/44458147@N00/5123523677
• Slide #25: https://www.flickr.com/photos/hodgers/450003437
Thanks!
Questions?

More Related Content

What's hot

Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
Frank Rousseau
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web appsVelocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
andrewsmatt
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
Caldera Labs
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
Deutsche Post
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
CasperJs Enjoy Functional Testing
CasperJs Enjoy Functional TestingCasperJs Enjoy Functional Testing
CasperJs Enjoy Functional Testing
Fabien POMEROL
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
Damien Seguin
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
Angular js vs. Facebook react
Angular js vs. Facebook reactAngular js vs. Facebook react
Angular js vs. Facebook react
Keyup
 
I18n
I18nI18n
I18n
soon
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
jimi-c
 
Python for AngularJS
Python for AngularJSPython for AngularJS
Python for AngularJS
Jeff Schenck
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2
A.K.M. Ahsrafuzzaman
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS
Hervé Vũ Roussel
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
VO Tho
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
postrational
 
Testing MeteorJS using CasperJS
Testing MeteorJS using CasperJSTesting MeteorJS using CasperJS
Testing MeteorJS using CasperJS
Stephan Hochhaus
 
PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽
Anna Su
 

What's hot (20)

Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web appsVelocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
CasperJs Enjoy Functional Testing
CasperJs Enjoy Functional TestingCasperJs Enjoy Functional Testing
CasperJs Enjoy Functional Testing
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Angular js vs. Facebook react
Angular js vs. Facebook reactAngular js vs. Facebook react
Angular js vs. Facebook react
 
I18n
I18nI18n
I18n
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Python for AngularJS
Python for AngularJSPython for AngularJS
Python for AngularJS
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
Testing MeteorJS using CasperJS
Testing MeteorJS using CasperJSTesting MeteorJS using CasperJS
Testing MeteorJS using CasperJS
 
PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽
 

Similar to The Peanut Butter Cup of Web-dev: Plack and single page web apps

Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
ExoLeaders.com
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
Toru Furukawa
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
Michelangelo van Dam
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
Stoyan Stefanov
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
Perl Careers
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
Damien Krotkine
 
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
Alain Hippolyte
 
Sprockets
SprocketsSprockets
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
defrag2
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
Filip Janevski
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Play framework
Play frameworkPlay framework
Play framework
Andrew Skiba
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budget
David Lukac
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
Alive Kuo
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
Jesús L. Domínguez Muriel
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
Christian Rokitta
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
Andrew Rota
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
aaronheckmann
 

Similar to The Peanut Butter Cup of Web-dev: Plack and single page web apps (20)

Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
Symfony Live 2018 - Développez votre frontend avec ReactJS et Symfony Webpack...
 
Sprockets
SprocketsSprockets
Sprockets
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Play framework
Play frameworkPlay framework
Play framework
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budget
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 

More from John Anderson

#speakerlife
#speakerlife#speakerlife
#speakerlife
John Anderson
 
Introduction to Git (even for non-developers)
Introduction to Git (even for non-developers)Introduction to Git (even for non-developers)
Introduction to Git (even for non-developers)
John Anderson
 
Logs are-magic-devfestweekend2018
Logs are-magic-devfestweekend2018Logs are-magic-devfestweekend2018
Logs are-magic-devfestweekend2018
John Anderson
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
John Anderson
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
John Anderson
 
Do you want to be right or do you want to WIN?
Do you want to be right or do you want to WIN?Do you want to be right or do you want to WIN?
Do you want to be right or do you want to WIN?
John Anderson
 
An Introduction to Git (even for non-developers)
An Introduction to Git (even for non-developers)An Introduction to Git (even for non-developers)
An Introduction to Git (even for non-developers)
John Anderson
 
You got chocolate in my peanut butter! .NET on Mac & Linux
You got chocolate in my peanut butter! .NET on Mac & LinuxYou got chocolate in my peanut butter! .NET on Mac & Linux
You got chocolate in my peanut butter! .NET on Mac & Linux
John Anderson
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
John Anderson
 
Old Dogs & New Tricks: What's New with Perl5 This Century
Old Dogs & New Tricks: What's New with Perl5 This CenturyOld Dogs & New Tricks: What's New with Perl5 This Century
Old Dogs & New Tricks: What's New with Perl5 This Century
John Anderson
 
Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)
John Anderson
 
Introduction to Git for Non-Developers
Introduction to Git for Non-DevelopersIntroduction to Git for Non-Developers
Introduction to Git for Non-Developers
John Anderson
 
A Modest Introduction To Swift
A Modest Introduction To SwiftA Modest Introduction To Swift
A Modest Introduction To Swift
John Anderson
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
John Anderson
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
John Anderson
 
JSON Web Tokens Will Improve Your Life
JSON Web Tokens Will Improve Your LifeJSON Web Tokens Will Improve Your Life
JSON Web Tokens Will Improve Your Life
John Anderson
 
Old Dogs & New Tricks: What's New With Perl5 This Century
Old Dogs & New Tricks: What's New With Perl5 This CenturyOld Dogs & New Tricks: What's New With Perl5 This Century
Old Dogs & New Tricks: What's New With Perl5 This Century
John Anderson
 
A Modest Introduction to Swift
A Modest Introduction to SwiftA Modest Introduction to Swift
A Modest Introduction to Swift
John Anderson
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
John Anderson
 
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
John Anderson
 

More from John Anderson (20)

#speakerlife
#speakerlife#speakerlife
#speakerlife
 
Introduction to Git (even for non-developers)
Introduction to Git (even for non-developers)Introduction to Git (even for non-developers)
Introduction to Git (even for non-developers)
 
Logs are-magic-devfestweekend2018
Logs are-magic-devfestweekend2018Logs are-magic-devfestweekend2018
Logs are-magic-devfestweekend2018
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
 
Do you want to be right or do you want to WIN?
Do you want to be right or do you want to WIN?Do you want to be right or do you want to WIN?
Do you want to be right or do you want to WIN?
 
An Introduction to Git (even for non-developers)
An Introduction to Git (even for non-developers)An Introduction to Git (even for non-developers)
An Introduction to Git (even for non-developers)
 
You got chocolate in my peanut butter! .NET on Mac & Linux
You got chocolate in my peanut butter! .NET on Mac & LinuxYou got chocolate in my peanut butter! .NET on Mac & Linux
You got chocolate in my peanut butter! .NET on Mac & Linux
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
 
Old Dogs & New Tricks: What's New with Perl5 This Century
Old Dogs & New Tricks: What's New with Perl5 This CenturyOld Dogs & New Tricks: What's New with Perl5 This Century
Old Dogs & New Tricks: What's New with Perl5 This Century
 
Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)
 
Introduction to Git for Non-Developers
Introduction to Git for Non-DevelopersIntroduction to Git for Non-Developers
Introduction to Git for Non-Developers
 
A Modest Introduction To Swift
A Modest Introduction To SwiftA Modest Introduction To Swift
A Modest Introduction To Swift
 
A static site generator should be your next language learning project
A static site generator should be your next language learning projectA static site generator should be your next language learning project
A static site generator should be your next language learning project
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
 
JSON Web Tokens Will Improve Your Life
JSON Web Tokens Will Improve Your LifeJSON Web Tokens Will Improve Your Life
JSON Web Tokens Will Improve Your Life
 
Old Dogs & New Tricks: What's New With Perl5 This Century
Old Dogs & New Tricks: What's New With Perl5 This CenturyOld Dogs & New Tricks: What's New With Perl5 This Century
Old Dogs & New Tricks: What's New With Perl5 This Century
 
A Modest Introduction to Swift
A Modest Introduction to SwiftA Modest Introduction to Swift
A Modest Introduction to Swift
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
 
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
Friends Don't Let Friends Browse Unencrypted: Running a VPN for friends and f...
 

Recently uploaded

HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
GNAMBIKARAO
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
dtagbe
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 
How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
Infosec train
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 

Recently uploaded (11)

HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 
How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 

The Peanut Butter Cup of Web-dev: Plack and single page web apps

  • 1. The peanut butter cup of web-dev: Plack & single page web apps @genehack ≈ 03 May 2014 ≈ DCBPW v3.0
  • 2. John SJ Anderson @genehack Director of Technology! Infinity Interactive
  • 3. Single-page applications • All "static" assets delivered in single page load • Page does not do full reload cycle during usage • May have backend returning JSON in response to user actions • Client-side Javascript code handles UI updates
  • 5. Angular.js • Client-side MVC Javascript framework • Developed at Google • "HTML enhanced" • Great for "single page" web apps
  • 6. Easy to get started with Angular <!DOCTYPE html> <html> <head> <title>Two Way Data Binding Demo</title> <script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script> <script type="text/javascript"> function demoCtrl ($scope) { $scope.demoValue = "foo" } </script> </head> <body ng-app> <div ng-controller="demoCtrl"> <h1>{{demoValue}}</h1> <input type="text" ng-model="demoValue" /> </div> </body> </html>
  • 7. <!DOCTYPE html> <html> <head> <title>Two Way Data Binding Demo</title> <script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script> <script type="text/javascript"> function demoCtrl ($scope) { $scope.demoValue = "foo" } </script> </head> <body ng-app> <div ng-controller="demoCtrl"> <h1>{{demoValue}}</h1> <input type="text" ng-model="demoValue" /> </div> </body> </html> Easy to get started with Angular Load angular library
  • 8. <!DOCTYPE html> <html> <head> <title>Two Way Data Binding Demo</title> <script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script> <script type="text/javascript"> function demoCtrl ($scope) { $scope.demoValue = "foo" } </script> </head> <body ng-app> <div ng-controller="demoCtrl"> <h1>{{demoValue}}</h1> <input type="text" ng-model="demoValue" /> </div> </body> </html> Easy to get started with Angular Bootstrap Angular
  • 9. <!DOCTYPE html> <html> <head> <title>Two Way Data Binding Demo</title> <script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script> <script type="text/javascript"> function demoCtrl ($scope) { $scope.demoValue = "foo" } </script> </head> <body ng-app> <div ng-controller="demoCtrl"> <h1>{{demoValue}}</h1> <input type="text" ng-model="demoValue" /> </div> </body> </html> Easy to get started with Angular Tie this <div> to this chunk of controller code (which means 'demoValue' is available)
  • 10. <!DOCTYPE html> <html> <head> <title>Two Way Data Binding Demo</title> <script type="text/javascript" src="http://code.angularjs.org/1.2.16/angular.min.js"></script> <script type="text/javascript"> function demoCtrl ($scope) { $scope.demoValue = "foo" } </script> </head> <body ng-app> <div ng-controller="demoCtrl"> <h1>{{demoValue}}</h1> <input type="text" ng-model="demoValue" /> </div> </body> </html> Easy to get started with Angular Angular template – replaced with value of demoValue Data binding – changing input changes value of demoValue
  • 14. You hit a brick wall.
  • 16. [ A noble yak enters from stage left. ]
  • 17. Javascript tools • express • node.js • grunt • yeoman • bower • npm
  • 18.
  • 19.
  • 20. Wait … I know Perl. Perl can serve files.
  • 21. plackfile #!/usr/bin/env perl ! use Plack::Runner; ! my $app = Plack::App::IndexFile->new({ root => shift })->to_app; my $runner = Plack::Runner->new; $runner->parse_options( '--access-log' => '/dev/null', @ARGV ); $runner->run( $app ); ! package Plack::App::IndexFile; use parent 'Plack::App::File'; sub locate_file { my( $self, $env ) = @_; my $path = $env->{PATH_INFO} || ''; ! return $self->SUPER::locate_file( $env ) unless $path && $path =~ m{/$}; ! $env->{PATH_INFO} .= 'index.html'; ! return $self->SUPER::locate_file( $env ); }
  • 22. Easy to grow that simple server… into a full Plack-based application.
  • 23. Prototyping with Plack • Static file serving • Middleware for session management • Authentication via middleware • Prototype your backend API (using OX or Dancer) • Possible to merge "typical" JS app layout and "typical" Perl module layout without conflicts
  • 24. Probably not appropriate for production… …but you can't live on just Reese's either.
  • 25. It is a fun easy way to started. Allows you to learn one new thing without having to learn a dozen new things at the same time.
  • 27. Photo credits • All photos either by me or CC-BY-SA; attributions below • Slide #1: https://www.flickr.com/photos/nettsu/4570198529 • Slide #4: https://www.flickr.com/photos/aprily/4196214910 • Slide #11: https://www.flickr.com/photos/quinnanya/3821453576 • Slide #12: https://www.flickr.com/photos/sarahseverson/6367143975 • Slide #14: https://www.flickr.com/photos/mvallius/10104902114 • Slide #15: https://www.flickr.com/photos/torkildr/3462607995 • Slide #16 & #26: https://www.flickr.com/photos/archer10/2661318228 • Slide #18: https://www.flickr.com/photos/eole/4407750708 • Slide #19: https://www.flickr.com/photos/kef08/2988576699 • Slide #20: https://www.flickr.com/photos/worldofoddy/146446352 • Slide #21: code from http://www.modernperlbooks.com/mt/2011/08/serving-a-local-directory-with-plack.html • Slide #22: https://www.flickr.com/photos/62172402@N07/9924983085 • Slide #24: https://www.flickr.com/photos/44458147@N00/5123523677 • Slide #25: https://www.flickr.com/photos/hodgers/450003437