Skip to content

Instantly share code, notes, and snippets.

@kkroesch
Created July 2, 2019 22:03
Show Gist options
  • Save kkroesch/ddf4d01b15d23c55070b434c04e7f599 to your computer and use it in GitHub Desktop.
Save kkroesch/ddf4d01b15d23c55070b434c04e7f599 to your computer and use it in GitHub Desktop.
Simple Application server with plugin contract
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