Today, developers are increasingly adopting Clojure as a web-development platform. See for yourself what makes Clojure so desirable, as you create a series of web apps of growing complexity, exploring the full process of web development using a modern functional language. This fully updated third edition reveals the changes in the rapidly evolving Clojure ecosystem and provides a practical, complete walkthrough of the Clojure web-stack.
Stop developing web apps with yesterday's tools. Today, developers are increasingly adopting Clojure as a web-development platform. See for yourself what makes Clojure so desirable, as you work hands-on with Clojure and build a series of web apps of increasing size and scope, culminating in a professional grade web app using all the techniques you've learned along the way.
This fully updated third edition will get you up to speed on the changes in the rapidly evolving Clojure ecosystem - the many new libraries, tools, and best practices. Build a fully featured SPA app with re-frame, a popular front-end framework for ClojureScript supporting a functional style MVC approach for managing the UI state in Single-Page Application-style applications. Gain expertise in the popular Ring/Compojure stack using the Luminus framework. Learn how Clojure works with databases and speeds development of RESTful services. See why ClojureScript is rapidly becoming a popular front-end platform, and use ClojureScript with the popular re-frame library to build single-page applications.
Whether you're already familiar with Clojure or completely new to the language, you'll be able to write web applications with Clojure at a professional level.
Author(s): Dmitri Sotnikov, Scot Brown
Edition: 3
Publisher: Pragmatic Bookshelf
Year: 2021
Language: English
Pages: 350
Tags: Clojure,Lisp,Web Development
Cover
Table of Contents
Acknowledgments
Introduction
What You Need
Why Clojure?
Why Make Web Apps in Clojure?
How to Read This Book
1. Getting Your Feet Wet
Set Up Your Environment
Managing Projects with Leiningen
Build Your First Web App
Refine Your App
What You’ve Learned
2. Luminus Web Stack
Route Requests with Ring
Extend Ring
Define the Routes with Reitit
HTML Templating Using Selmer
What You've Learned
3. Luminus Architecture
Manage the Project
Think in Terms of Application Components
Managing Stateful Components
What You've Learned
4. Introducing Clojurescript
Understand ClojureScript
Add ClojureScript Support
Build the UI with Reagent
Managing State with Re-Frame
What You’ve Learned
5. Setting Up for Success
Services
ClojureScript Development Tools
Embracing Re-Frame
Multi-User With Websockets
Upgrading to Sente
Events and Effects in Re-Frame
What You’ve Learned
6. Planning Our Application
What’s in our MVP?
The Elephant in the Room
Data Modelling
Adding User Management
What you’ve learned
7. Account Management
Authorship
Add Author’s Posts Page
Account Customization
Account Settings
What You’ve Learned
8. Social Interaction
Improving Posts
Curating Posts
What you’ve learned
9. Deployment
Unit Tests
Package the Application
What You’ve Learned
10. Exercises
How to Read this Chapter
Code Quality
Feature Enhancements
What You’ve Learned
A1. Clojure Primer
A Functional Perspective
Data Types
Using Functions
Anonymous Functions
Named Functions
Higher-Order Functions
Closures
Threading Expressions
Being Lazy
Structuring the Code
Destructuring Data
Namespaces
Dynamic Variables
Polymorphism
What About Global State?
Writing Code That Writes Code for You
The Read-Evaluate-Print Loop
Calling Out to Java
Calling Methods
Reader Conditionals
Summary
A2. Editor Configuration
Why is Editor Integration So Important?
General Configuration Tips
VSCode + Calva
IntelliJ IDEA + Cursive
Emacs + Cider
Vim
A3. Working with EDN and Transit
EDN
Transit
A4. Database Access
Work with Relational Databases
Use HugSQL
Generate Reports
What You've Learned
A5. Writing RESTful Web Services with Liberator
Using Liberator
Defining Resources
Putting It All Together
A6. Leiningen Templates
What's in a Template