Created
July 2, 2019 22:03
-
-
Save kkroesch/ddf4d01b15d23c55070b434c04e7f599 to your computer and use it in GitHub Desktop.
Simple Application server with plugin contract
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 characters
from bottle import route, run, template, abort, Response | |
APP_VERSION = '0.1.1' | |
@route('/hello/<name>') | |
def index(name): | |
return template('<b>Hello {{name}}</b>!', name=name) | |
@route('/package.json') | |
def package(): | |
return { | |
'name': 'test-project', | |
'version': APP_VERSION, | |
'description': 'A sample app.', | |
'url': 'https://mailtools.bluewin.ch/test/', | |
} | |
@route('/health') | |
def health(): | |
return Response('200 OK', 200) | |
@route('/unhealth') | |
def unhealth(): | |
return abort(503, '503 Service Unavailable') | |
if __name__ == "__main__": | |
# run(server='bjoern', host='localhost', port=8080, reloader=True) | |
run(host='localhost', port=8080, reloader=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment