1 / 22

Intro to API Development with Mojolicous

Intro to API Development with Mojolicous. Matt Monsen. 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.

leia
Download Presentation

Intro to API Development with Mojolicous

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. • JSON and HTML/XML parser with CSS selector support.

  3. Installation $ curl get.mojolicio.us| sh

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

  5. Getting Started To run this example with the built-in development web server $ morboperl.pl Server available at http://127.0.0.1:3000. $ curl http://127.0.0.1:3000/ I <3 Perl!

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

  7. $ 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

  8. $ 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

  9. Routing – Controller – Action

  10. Rendering

  11. Rendering

  12. Deployment CGI PSGI Daemon

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

  14. Deployment Morbo Run Development Mode $ morbo script/hello Server available at http://127.0.0.1:3000

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

  16. Testing

  17. Testing $ perlscript/hello test Running tests from '/home/matt/hello/t’. script/../t/basic.t .. ok All tests successful. Files=1, Tests=3, 1 wallclocksecs ( 0.03 usr 0.01 sys + 0.32 cusr 0.04 csys = 0.40 CPU) Result: PASS

  18. Mojocasts.com

More Related