Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to API Development with Mojolicous Matt Monsen.

Similar presentations


Presentation on theme: "Intro to API Development with Mojolicous Matt Monsen."— Presentation transcript:

1 Intro to API Development with Mojolicous Matt Monsen

2 Features  An amazing real-time web framework.  Very clean, portable and Object Oriented pure-Perl API.  Full stack HTTP and WebSocket client/server implementation.  Built-in non-blocking I/O web server.  Automatic CGI and PSGI detection.PSGI  JSON and HTML/XML parser with CSS selector support.

3 Installation $ curl get.mojolicio.us | sh

4 Getting Started use Mojolicious::Lite; get '/' => { text => ’I <3 Perl!’ }; app->start; These three lines are a whole web application

5 Getting Started $ morbo perl.pl Server available at $ curl I <3 Perl! To run this example with the built-in development web server

6 Getting Started To run this example with the built-in development web server

7

8

9 $ mojo generate app Hello [mkdir] /home/matt/hello/script [write] /home/matt/hello/script/hello [chmod] hello/script/hello 744 [mkdir] /home/matt/hello/lib [write] /home/matt/hello/lib/Hello.pm [mkdir] /home/matt/hello/lib/Hello [write] /home/matt/hello/lib/Hello/Example.pm [mkdir] /home/matt/hello/t [write] /home/matt/hello/t/basic.t [mkdir] /home/matt/hello/log [mkdir] /home/matt/hello/public [write] /home/matt/hello/public/index.html [mkdir] /home/matt/hello/templates/layouts [write] /home/matt/hello/templates/layouts/default.html.ep [mkdir] /home/matt/hello/templates/example [write] /home/matt/hello/templates/example/welcome.html.ep

10 $ mojo generate app Hello [mkdir] /home/matt/hello/script [write] /home/matt/hello/script/hello [chmod] hello/script/hello 744 [mkdir] /home/matt/hello/lib [write] /home/matt/hello/lib/Hello.pm [mkdir] /home/matt/hello/lib/Hello [write] /home/matt/hello/lib/Hello/Example.pm [mkdir] /home/matt/hello/t [write] /home/matt/hello/t/basic.t [mkdir] /home/matt/hello/log [mkdir] /home/matt/hello/public [write] /home/matt/hello/public/index.html [mkdir] /home/matt/hello/templates/layouts [write] /home/matt/hello/templates/layouts/default.html.ep [mkdir] /home/matt/hello/templates/example [write] /home/matt/hello/templates/example/welcome.html.ep

11 Routing – Controller – Action

12 Rendering

13

14 Deployment CGI PSGI Daemon

15 Deployment Daemon Morbo Development Server Hypnotoad Hot-code reloading production server

16 Deployment Run Development Mode $ morbo script/hello Server available at Morbo

17 Deployment Run & Reload $ hypnotoad script/hello Stop $ hypnotoad –s script/hello Hypnotoad

18 Testing

19 $ perl script/hello test Running tests from '/home/matt/hello/t’. script/../t/basic.t.. ok All tests successful. Files=1, Tests=3, 1 wallclock secs ( 0.03 usr 0.01 sys cusr 0.04 csys = 0.40 CPU) Result: PASS

20

21

22 Mojocasts.com


Download ppt "Intro to API Development with Mojolicous Matt Monsen."

Similar presentations


Ads by Google