Skip to content

Instantly share code, notes, and snippets.

@goodwillcoding
Created January 4, 2016 06:49
Show Gist options
  • Save goodwillcoding/acab29e74c264ce178c4 to your computer and use it in GitHub Desktop.
Save goodwillcoding/acab29e74c264ce178c4 to your computer and use it in GitHub Desktop.
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from rest_toolkit import resource
@resource('/')
class Greeting(object):
def __init__(self, request):
pass
@Greeting.GET()
def show_root(root, request):
return {'message': 'Hello, world'}
if __name__ == '__main__':
config = Configurator()
config.include('rest_toolkit')
config.scan()
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment