Building Web Apps in Ratpack

  • 1,499 views
Uploaded on

see description

see description

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,499
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
16
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Micro-services: So-called “Thin Server Architecture” High-throughput: 22,000 messages per second (http://netty.io/testimonials)
  • demo1/demo1.groovyview headers: curl -I http://localhost:5050post: curl -X POST http://localhost:5050/apiview static: http://localhost:5050/dan.htmlview headers of static content: curl -I http://localhost:5050/dan.html
  • demo2/demo2.groovyput: curl -X PUT http://localhost:5050/apipost: curl -X PUT http://localhost:5050/api
  • demo3/demo3.groovyContent negotiation is driven by the “Accept” headerget: curl -H “Accept: application/json” http://localhost:5050
  • demo4“gradle run” to run the app- IntelliJ support for Ratpack
  • demo4“gradle run” to run the app- IntelliJ support for Ratpack
  • demo4“gradle run” to run the app- IntelliJ support for Ratpack
  • demo5
  • demo5
  • demo5
  • demo6http://localhost:5050/http://localhost:5050/?name=Dan
  • demo6http://localhost:5050/eventhttp://localhost:5050/event/Dan
  • demo7http://localhost:5050/groovymn.png
  • demo7Run from the command line: build/install/demo7/bin/demo7
  • demo7Packaged app with runnable script: build/distributions/demo7.zip
  • demo7
  • demo7
  • demo7
  • demo7
  • demo7
  • demo7
  • demo7
  • demo7
  • … at a future meetuphttp://twitter.com/beckje01

Transcript

  • 1. Building Web Apps in Ratpack Daniel Woods October 2013
  • 2. About Me @danveloper #editor /danveloper daniel.p.woods
  • 3. Welcome to Ratpack • Inspired by Ruby’s Sinatra Framework • Built on Netty • Written in Java, Optimized for Groovy • Also, Java 7 & Java 8 • Totally unopinionated framework • Optional Google Guice integration • Optional Gradle integration • Rapid development with SpringLoaded
  • 4. When to use Ratpack? • Micro-services • Supporting Single-Page Applications • High-throughput apps • Lightweight apps • No Container! • Cloud Deployments • Simple packaging strategy • Mock Services in Test?
  • 5. Quick Intro to Ratpack • Runnable from a Groovy script!
  • 6. Quick Intro to Ratpack • Simple Groovy DSL for Handler chain
  • 7. Quick Intro to Ratpack • Support for prefixed endpoints
  • 8. Quick Intro to Ratpack • Handling content-type
  • 9. More Complex Needs… • Gradle
  • 10. More Complex Needs… • Dependency Injection
  • 11. More Complex Needs… • Modules
  • 12. Getting all Dynamic… • Templates
  • 13. Getting all Dynamic… • Templates
  • 14. Getting all Dynamic… • Handlebars Template Support!
  • 15. Accessing Parameters • request.queryParams
  • 16. Accessing Parameters • context.pathTokens
  • 17. Modularizing Handlers • MongoDBAssetHandler example
  • 18. Building Ratpack • gradle installApp
  • 19. Packaging Ratpack • gradle distZip
  • 20. Deploying Ratpack • Heroku • Step 0 – Add the Gradle Wrapper to your Project
  • 21. Deploying Ratpack • Heroku • Step 0.1 – Add a settings.gradle file to your Project • Setting the rootProject.name = ‘demo’ will allow the buildpack to work properly.
  • 22. Deploying Ratpack • Heroku • Step 1 – Authenticate on Terminal
  • 23. Deploying Ratpack • Heroku • Step 2 – Create your app with Heroku
  • 24. Deploying Ratpack • Heroku • Step 3 – Configure the buildpack
  • 25. Deploying Ratpack • Heroku • Step 4.0 – git init (if you haven’t already) • Step 4.1 – add Heroku app’s remote git endpoint • Step 4.2 – git push -u heroku master
  • 26. Deploying Ratpack • Heroku • Step 5 – Visit App
  • 27. Deploying Ratpack • Heroku • Step 5 – Visit App
  • 28. Testing Ratpack Apps Jeff Beck @beckje01
  • 29. Ratpack Resources • The Ratpack Manual • http://www.ratpack-framework.org/manual/current/ • Ratpack GitHub (Samples, etc) • https://github.com/ratpack • Continuous Integration • http://drone.io • ??? (tweet me!) • Tomas Lin, Cloud Foundry deployment • http://fbflex.wordpress.com/2013/08/07/ratpack-to-cloudfoundry-with-java-buildpack/
  • 30. The End