8000 GitHub - johncowie/scenic: A wrapper for the Bidi routing library, to make the routes a bit more 'pretty'
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A wrapper for the Bidi routing library, to make the routes a bit more 'pretty'

Notifications You must be signed in to change notification settings

johncowie/scenic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clojars Project

scenic

Scenic is a simple thin wrapper around http://github.com/juxt/bidi that translates routes in a routes.rb-ish file to a Bidi routes data structure.

Example Usage

Create a routes file and put it somewhere on the class path (eg. my_project/resources/my_routes.routes). It should have the format <METHOD> <PATH> <ID>

The <ID> is a keyword which should be used to point to a controller function.

GET   /       home
GET   /login  login-form
POST  /login  login

Then in your app use load-routes-from-file and scenic-routes functions to create a ring handler.

(ns my_project.core
  (:require [scenic.routes] :refer :all))

(defn home [request]
  "hello")

(def handler 
  (scenic-handler (load-routes-from-file "my_routes.routes") {:home home})

(defn -main [& args]
  (run-server handler {:port 9001}))

License

Copyright © 2014 John Cowie

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

About

A wrapper for the Bidi routing library, to make the routes a bit more 'pretty'

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0