source: src/mapservice/src-gen/openapi_server/__main__.py@ 041e464

debian/bullseye
Last change on this file since 041e464 was 5e4cb73, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Refactored mapservice

  • mapservice is a connexion python webservice with openapi defined api
  • mapservice-webclient is a angular app, consuming the openapi webservice mapservice
  • Property mode set to 100644
File size: 825 bytes
Line 
1#!/usr/bin/env python3
2
3import connexion
4from flask_cors import CORS
5from flask import render_template
6
7from openapi_server import encoder
8
9from openapi_server.server_impl.database.Model import db, User, ApiKey, db_test_setup
10
11app = connexion.App(__name__, specification_dir='./openapi/')
12application = app.app
13CORS(application)
14
15@application.before_first_request
16def create_database():
17 db_test_setup()
18
19@application.route("/mapservice/")
20def index():
21 return render_template('index.html')
22
23def main():
24 application.json_encoder = encoder.JSONEncoder
25 app.add_api('openapi.yaml', arguments={'title': 'GNUBoat Mapservice API'}, validate_responses=True)
26 application.config.from_object('openapi_server.server_impl.Config.DevelopmentConfig')
27
28 db.init_app(application)
29
30 app.run(port=8080)
31
32if __name__ == '__main__':
33 main()
Note: See TracBrowser for help on using the repository browser.