debian/bullseye
|
Last change
on this file since 28198a1 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 |
|
|---|
| 3 | import connexion
|
|---|
| 4 | from flask_cors import CORS
|
|---|
| 5 | from flask import render_template
|
|---|
| 6 |
|
|---|
| 7 | from openapi_server import encoder
|
|---|
| 8 |
|
|---|
| 9 | from openapi_server.server_impl.database.Model import db, User, ApiKey, db_test_setup
|
|---|
| 10 |
|
|---|
| 11 | app = connexion.App(__name__, specification_dir='./openapi/')
|
|---|
| 12 | application = app.app
|
|---|
| 13 | CORS(application)
|
|---|
| 14 |
|
|---|
| 15 | @application.before_first_request
|
|---|
| 16 | def create_database():
|
|---|
| 17 | db_test_setup()
|
|---|
| 18 |
|
|---|
| 19 | @application.route("/mapservice/")
|
|---|
| 20 | def index():
|
|---|
| 21 | return render_template('index.html')
|
|---|
| 22 |
|
|---|
| 23 | def 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 |
|
|---|
| 32 | if __name__ == '__main__':
|
|---|
| 33 | main()
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.