5. A REST Client in ClojureScript

It’s a common pattern to write client-server applications with a JavaScript client. The inventor of Clojure, Rich Hickey, said at the announcement of ClojureScript, “Clojure rocks, JavaScript reaches.”1 He meant that it is great to be able to write Clojure that runs on the server JVM and the client browser in JavaScript. We’re going to work through a pattern for doing this.

1. ClojureScript Announcement, July 2011, https://www.youtube.com/watch?v=tVooR-dF_Ag

In this recipe we will create a client in ClojureScript that will make a REST call. Then we will reuse the REST server from the previous chapter to receive the call. We will see the entire process end to end.

Assumptions

In this chapter we assume the following: ...

Get Clojure Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.