/lein-web-template

Leiningen template for a web-server in clojure

Primary LanguageClojure

lein-web-template

A leiningen plugin to create a ring-compojure web project. It packages Moustache (using stencil) and Hiccup rendering, you can add others if you need. It only works with leiningen 2.

Installing

Just add lein-web-template in your :plugins section of your :user profile in ~/.lein/profiles.clj:

{:user {:plugins [[org.clojars.kiran/lein-web-template "0.2.1"]]}}

on next run of lein plugin will be installed

Usage

To create a new project simply execute following command

$ lein new web-template <project_name>

Replace <project_name> with your project name e.g.

$ lein new web-template nuggets

You will get following tree

$ cd nuggets
$ tree
.
|___ project.clj
|___ resources
| |___ static
| | |___ css
| | | |___ screen.css
| |___ templates
| | |___ stencil.html
|___ src
| |___ nuggets
| | |___ core.clj

To test the server execute run command

$ lein run
Compiling nuggets.core
2013-01-08 13:13:07.446:INFO:oejs.Server:jetty-7.6.1.v20120215
Started server, Browse http://localhost:8080/
2013-01-08 13:13:07.493:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080

As you can see server will be started on 8080 port.