Git Product home page Git Product logo

scenic's Introduction

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.

scenic's People

Contributors

johncowie avatar gtrogers avatar eduaquiles avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.