O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Building Web Apps in Ratpack

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Ratpack Web Framework
Ratpack Web Framework
Carregando em…3
×

Confira estes a seguir

1 de 30 Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Quem viu também gostou (20)

Anúncio

Semelhante a Building Web Apps in Ratpack (20)

Anúncio

Mais recentes (20)

Building Web Apps in Ratpack

  1. 1. Building Web Apps in Ratpack Daniel Woods October 2013
  2. 2. About Me @danveloper #editor /danveloper daniel.p.woods
  3. 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. 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. 5. Quick Intro to Ratpack • Runnable from a Groovy script!
  6. 6. Quick Intro to Ratpack • Simple Groovy DSL for Handler chain
  7. 7. Quick Intro to Ratpack • Support for prefixed endpoints
  8. 8. Quick Intro to Ratpack • Handling content-type
  9. 9. More Complex Needs… • Gradle
  10. 10. More Complex Needs… • Dependency Injection
  11. 11. More Complex Needs… • Modules
  12. 12. Getting all Dynamic… • Templates
  13. 13. Getting all Dynamic… • Templates
  14. 14. Getting all Dynamic… • Handlebars Template Support!
  15. 15. Accessing Parameters • request.queryParams
  16. 16. Accessing Parameters • context.pathTokens
  17. 17. Modularizing Handlers • MongoDBAssetHandler example
  18. 18. Building Ratpack • gradle installApp
  19. 19. Packaging Ratpack • gradle distZip
  20. 20. Deploying Ratpack • Heroku • Step 0 – Add the Gradle Wrapper to your Project
  21. 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. 22. Deploying Ratpack • Heroku • Step 1 – Authenticate on Terminal
  23. 23. Deploying Ratpack • Heroku • Step 2 – Create your app with Heroku
  24. 24. Deploying Ratpack • Heroku • Step 3 – Configure the buildpack
  25. 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. 26. Deploying Ratpack • Heroku • Step 5 – Visit App
  27. 27. Deploying Ratpack • Heroku • Step 5 – Visit App
  28. 28. Testing Ratpack Apps Jeff Beck @beckje01
  29. 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. 30. The End

Notas do Editor

  • 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

×