Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo
Web Development with Clojure, 2nd Edition

Book Description

Modern web applications deserve modern tools. Harness the JVM's rich infrastructure while taking advantage of the expressive power and brisk performance of a modern functional language. Exploit Clojure's unique advantages for web development. Step by step, apply the fundamentals of programming in Clojure to build real-world, professional web applications. This edition features new libraries, tools, and best practices, and focuses on developing modern single-page applications.

Table of Contents

  1.  Acknowledgments
  2.  Introduction
    1. What You Need
    2. Why Clojure?
    3. Why Make Web Apps in Clojure?
  3. 1. Getting Your Feet Wet
    1. Set Up Your Environment
    2. Build Your First Web App
    3. Refine Your App
    4. What You’ve Learned
  4. 2. Luminus Web Stack
    1. Route Requests with Ring
    2. Extend Ring
    3. Define the Routes with Compojure
    4. HTML Templating Using Selmer
    5. What You’ve Learned
  5. 3. Luminus Architecture
    1. Manage the Project
    2. Think in Terms of Application Components
    3. Managing Stateful Components
    4. What You’ve Learned
  6. 4. Add ClojureScript
    1. Understand ClojureScript
    2. Configure ClojureScript
    3. Add ClojureScript Support
    4. Build the UI with Reagent
    5. What You’ve Learned
  7. 5. Real-Time Messaging with WebSockets
    1. Set Up WebSockets on the Server
    2. Make WebSockets from ClojureScript
    3. WebSockets Using Sente
    4. What You’ve Learned
  8. 6. Writing RESTful Web Services
    1. Use Compojure-api
    2. Creating the API
    3. What You’ve Learned
  9. 7. Database Access
    1. Work with Relational Databases
    2. Use HugSQL
    3. Generate Reports
    4. What You’ve Learned
  10. 8. Picture Gallery
    1. The Development Process
    2. What’s in a Gallery
    3. Create the Application
    4. Configure the Database
    5. Task A: Account Registration
    6. Task B: Login and Logout
    7. Task C: Uploading Pictures
    8. Task D: Displaying Pictures
    9. Task E: Deleting Pictures
    10. Task F: Account Deletion
    11. Adding Some Color
    12. What You’ve Learned
  11. 9. Finishing Touches
    1. Unit Tests
    2. Package the Application
    3. What You’ve Learned
  12. A1. Clojure Primer
    1. A Functional Perspective
    2. Data Types
    3. Using Functions
    4. Anonymous Functions
    5. Named Functions
    6. Higher-Order Functions
    7. Closures
    8. Threading Expressions
    9. Being Lazy
    10. Structuring the Code
    11. Destructuring Data
    12. Namespaces
    13. Dynamic Variables
    14. Polymorphism
    15. What About Global State?
    16. Writing Code That Writes Code for You
    17. The Read-Evaluate-Print Loop
    18. Calling Out to Java
    19. Calling Methods
    20. Summary
  13. A2. Authentication with OAuth
    1. Why Use OAuth
  14. A3. Document-Oriented Database Access
    1. Picking the Right Database
    2. Using CouchDB
    3. Using MongoDB
  15. A4. Writing RESTful Web Services with Liberator
    1. Using Liberator
    2. Defining Resources
    3. Putting It All Together
  16. A5. Leiningen Templates
    1. What’s in a Template