Created
February 16, 2018 16:43
-
-
Save andykuszyk/2fdea6f9af18ce987399b1108c9f21ae to your computer and use it in GitHub Desktop.
Revisions
-
andykuszyk created this gist
Feb 16, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ import falcon import waitress import json class HelloWorldResource: def on_post(self, req, resp): content = req.stream.read().decode() if content == 'spam': resp.body = json.dumps('eggs') elif content == 'foo': resp.body = json.dumps('bar') else: resp.status = falcon.HTTP_404 if __name__ == '__main__': api = falcon.API() api.add_route('/helloworld', HelloWorldResource()) waitress.serve(api, host="0.0.0.0", port=8080, threads=4)