12345678910111213141516171819202122232425 |
- import connection
- import controller
- import model
- from bottle import run, request, response, route
- from controller import not_found
- if __name__ == '__main__':
- print('sqlite3.version', model.db.version)
- model.setup()
- valid_routes = ['login', 'register']
- @route('/<path>', method='POST')
- def process(path):
- if path not in valid_routes:
- return not_found()
- response.content_type = 'application/json'
- method_to_call = getattr(controller, path)
- return method_to_call()
- run(host='localhost', port=connection.port, debug=True)
|