Skip to content

Commit

Permalink
Now "/api" for GET response
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerkumar18 authored Jun 17, 2017
1 parent ec049ee commit 9cdca1d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn app:app
14 changes: 11 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,25 @@
reload(sys)
sys.setdefaultencoding('utf-8')

class API(Resource):
class APP(Resource):
def get(self):
return {'this is should become a ->': 'website'}
return {'this is soon to become an awesome->': 'website'}

def post(self):
jk = joke.getJoke()
jk = jk.encode('ascii', 'ignore').decode('ascii')
#jk = jk.encode('utf-8')
return jk

api.add_resource(API, '/')
class API(Resource):
def get(self):
jk = joke.getJoke()
jk = jk.encode('ascii', 'ignore').decode('ascii')
# jk = jk.encode('utf-8')
return jk

api.add_resource(APP, '/')
api.add_resource(API, '/api')

if __name__ == '__main__':
app.run(debug=True)
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Flask==0.11.1
gunicorn==19.7.0
httplib2==0.9.2
Jinja2==2.8
virtualenv==15.1.0
Werkzeug==0.11.10
flask-restful

0 comments on commit 9cdca1d

Please sign in to comment.