Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Created February 10, 2014 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuuichi-fujioka/8911702 to your computer and use it in GitHub Desktop.
Save yuuichi-fujioka/8911702 to your computer and use it in GitHub Desktop.
REST API with pecan
import eventlet
from eventlet import wsgi
import pecan
from pecan import rest
class V1Controller(rest.RestController):
@pecan.expose()
def get(self, id):
return id
class Root(object):
v1 = V1Controller()
config = {
'root': Root,
'debug': True,
}
def _make_app():
app = pecan.make_app(**config)
return app
def main():
eventlet.monkey_patch()
app = _make_app()
wsgi.server(eventlet.listen(('', 8899)), app)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment