Pārlūkot izejas kodu

Enable swagger_ui with documentation

Guénaël Muller 6 gadus atpakaļ
vecāks
revīzija
f6ebb0c301
2 mainītis faili ar 19 papildinājumiem un 5 dzēšanām
  1. 14 0
      README.md
  2. 5 5
      tracim/__init__.py

+ 14 - 0
README.md Parādīt failu

@@ -90,6 +90,20 @@ Run pep8 checks:
90 90
 
91 91
     pep8 tracim
92 92
 
93
+Tracim API
94
+----------
95
+
96
+Tracim_backend give access to a REST API in */api/v2*.
97
+This API is auto-documented with [Hapic](https://github.com/algoo/hapic).
98
+The specification is accessible when you run Tracim, go to */api/v2/doc* .
99
+
100
+For example, with default config:
101
+
102
+    # run tracim
103
+    pserve development.ini
104
+    # launch your favorite web-browser
105
+    firefox http://localhost:6543/api/v2/doc/
106
+
93 107
 CI
94 108
 ---
95 109
 

+ 5 - 5
tracim/__init__.py Parādīt failu

@@ -50,9 +50,9 @@ def main(global_config, **settings):
50 50
     default_controllers.bind(configurator)
51 51
     session_api = SessionController()
52 52
     session_api.bind(configurator)
53
-    # hapic.add_documentation_view(
54
-    #     '/api/v2/doc',
55
-    #     'Tracim v2 API',
56
-    #     'API of Tracim v2',
57
-    # )
53
+    hapic.add_documentation_view(
54
+        '/api/v2/doc',
55
+        'Tracim v2 API',
56
+        'API of Tracim v2',
57
+    )
58 58
     return configurator.make_wsgi_app()