/bn-webservice

Bright North standard Clojure webservice template

Primary LanguageClojure

bn-webservice

A Leiningen template for creating Bright North's standard web service layer apps

Includes a stack of useful Clojure libraries and patterns:

  • Compojure routing
  • A sensible default set of ring middleware
  • Setup for both lein ring server and uberjar invocation
  • Korma for SQL manipulation
  • Midje for testing
  • conf-er for configuring the app (db details etc)
  • Liberator for RESTful resource handling

And some wrappers round useful Java libraries:

Usage

First grab the template and install it (it's not on clojars ... yet)

 git clone https://github.com/BrightNorth/bn-webservice
 cd bn-webservice
 lein install

Then edit your ''~/.lein/profiles.clj'' to include the plugin

 {:user {:plugins [[bn-webservice/lein-template "0.1.0-SNAPSHOT"]]}}

Then you can create a project using the template as follows:

 cd <my-working-directory>
 lein new bn-webservice <project-name>

Provided you have created database as per instructions below, you can now start application by:

 cd <project-name>
 lein ring server

DB

Create the DB as follows (if your project name contains dashes replace them for undescore when creating database):

mysql -uroot -p <password> <enter>
create database <project-name>;
grant all on <project-name>.* to '<project-name>'@'localhost' identified by '<project-name>';
flush privileges;

Todo

Midje tests

License

Copyright © 2013 Bright North (http://www.brightnorth.co.uk)

Distributed under the Eclipse Public License, the same as Clojure.