DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Clojure Web Development


Paredit

ParEdit, a.k.a. "structured editing", is some special editing operations for S-expression coding, like Lisp or Clojure. Mainstream IDEs all have support for paredit.

Eclipse

Install clojure IDE plugin counterclockwise. It's default shortcuts is listed in Editor Keyboard Shortcuts;

Cursive

Cursive: install IntelliJ and Cursive plugin, see default shortcuts definition at Structural editing;

REPL for Ring Application

Say the application name is "guestbook" (based on "Web Development with Clojure" by Dmitri Sotnikov).

Eclipse

The counterclockwise plugin need to be installed beforehand.

  1. Build a new "Clojure Project" with name "guestbook", set "Leiningen template" as "compojure-app";

  2. Open guestbook.routes.home.clj, and run menu item [Clojure -> Load file in REPL];

  3. In REPL window (the window title is "REPL @ nrepl://127.0.0.1:xxxx(guestbook.routes.home)", run (use 'guestbook.repl) and (start-server), you can use Ctrl+Up/Down to navigate in command history;

  4. See homepage with url "http://localhost:8080";

  5. Modify codes, refresh web page to see the result. If this doesn't work, close the REPL window and restart server;

Cursive

  1. In terminal: lein new compojure-app mybook;

  2. In Cursive, import "mybook" via "Import Project", choose "Leiningen" for "Import project from external model";

  3. Open "Terminal" window in Cursive, run lein repl, (use 'guestbook.repl) and (start-server);

  4. See homepage with url "http://localhost:8080";

  5. Modify codes, refresh web page to see the result. If this doesn't work, restart server in "Terminal" window;

Note: I've tried Light Table. It can open the guestbook project created by leiningen, but can't connect to it. So I give it up, and use Eclipse instead.



Published

Oct 2, 2014

Last Updated

Oct 2, 2014

Category

Tech

Tags

  • clojure 26
  • cursive 1
  • eclipse 40
  • paredit 1
  • ring 2
  • web 16

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor