O'Reilly logo

Clojure Recipes by Julian Gamble

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

6. A Simple JSON Server

The default data protocol of front-end JavaScript websites is JSON. When you’re writing a back-end service, handling JSON is becoming essential. This chapter will build a JSON server in ClojureScript.

In this recipe you use Clojure to create a simple JSON server. We create a new Clojure project, create an HTML page with JavaScript to post the JSON, and create a Clojure server in Compojure to receive the request and return a response. Then we’ll process and display that response in the HTML page’s JavaScript.

Assumptions

In this chapter we assume the following:

Image You know enough JavaScript to recognize a JSON post and receive ...

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

Start Free Trial

No credit card required