# example.py
from pycnic.core import WSGI, Handler
class Hello(Handler):
def get(self, name="World"):
return { "message":"Hello, %s!"%(name) }
class app(WSGI):
routes = [
('/', Hello()),
('/([\w]+)', Hello())
]
Run it with a WSGI server, like Gunicorn.
gunicorn example:app
Because Pycnic is small, standalone, and optimized for JSON API servers, it's no surprise that it holds up so well against other popular frameworks.
See the code© 2015 Nullism - Licensed under MIT