All Projects → pyx → hyer

pyx / hyer

Licence: other
Hyer - Hy enhanced routing

Programming Languages

Hy
24 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to hyer

raider
OWASP Raider: a novel framework for manipulating the HTTP processes of persistent sessions
Stars: ✭ 88 (+417.65%)
Mutual labels:  hy
hymn
Hy Monad Notation - a monad library for Hy
Stars: ✭ 47 (+176.47%)
Mutual labels:  hy
Hy
A dialect of Lisp that's embedded in Python
Stars: ✭ 4,084 (+23923.53%)
Mutual labels:  hy
hyclops
Clojurey functions for Hy (a lisp on top of Python)
Stars: ✭ 15 (-11.76%)
Mutual labels:  hy

Hyer - Hy enhanced routing

Introduction

Hyer is a collection of Hy macros for flask

Okay, show me some code

From examples/hello/app.hy

(require hyer.dsl)

(defn create-app []
  "application factory"
  (defapplication app []
    (GET index "/"
      "Hello world")
    (GET greeting "/<username>/"
      (.format "Hello, {}!" username))
    (GET addition "/<int:a>+<int:b>/"
      (.format "{} + {} = {}" a b (+ a b)))))

(defmain [&rest args]
  (-> create-app apply .run))

This is the same code in pure python:

from flask import Flask

def create_app():
    """application factory"""
    app = Flask(__name__)

    @app.route('/')
    def index():
        return 'Hello world'

    @app.route('/<username>/')
    def greeting(username):
        return 'Hello, {}!'.format(username)

    @app.route('/<int:a>+<int:b>/')
    def addition(a, b):
        return '{} + {} = {}'.format(a, b, a + b)

    return app


if __name__ == '__main__':
    create_app().run()

Requirements

  • CPython >= 2.7
  • flask
  • hy >= 0.10.1

Installation

Install from PyPI:

pip install hyer

In source directory, run:

make install

License

BSD New, see LICENSE for details.

Links

Documentation:
http://hyer.readthedocs.org/
Issue Tracker:
https://bitbucket.org/pyx/hyer/issues/
Source Package @ PyPI:
https://pypi.python.org/pypi/hyer/
Mercurial Repository @ bitbucket:
https://bitbucket.org/pyx/hyer/
Git Repository @ Github:
https://github.com/pyx/hyer/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].