|
@@ -1,13 +1,87 @@
|
1
|
1
|
[](https://travis-ci.org/algoo/hapic)
|
2
|
2
|
[](https://coveralls.io/github/algoo/hapic?branch=master)
|
3
|
3
|
|
4
|
|
-# hapic
|
5
|
|
-Input/Output/Error management for your python controllers with Swagger doc generation
|
|
4
|
+# Hapic in a nutshell
|
6
|
5
|
|
7
|
|
-## Presentation
|
|
6
|
+Hapic is a framework-agnostic library for implementation of professionnal REST APIs.
|
8
|
7
|
|
9
|
|
-Hapic is in unstable and development mode. More information soon.
|
|
8
|
+Why you should use Hapic :
|
|
9
|
+
|
|
10
|
+- Hapic adapt naturally to your existing libraries
|
|
11
|
+- Hapic map exceptions to HTTP errors without effort
|
|
12
|
+- Hapic really auto-documents your APIs according to marshmallow, apispec and web framework routing. You do not "write your doc in docstrings": the documentation is really auto-generated
|
|
13
|
+- Hapic can be used out-of-the-box with Bottle, Flask or Pyramid
|
|
14
|
+
|
|
15
|
+Hapic works with JSON, but it can be used for XML or virtually any data structure format.
|
|
16
|
+
|
|
17
|
+Auto-generated documentation can be visualised with swagger.
|
|
18
|
+
|
|
19
|
+## Philosophy
|
|
20
|
+
|
|
21
|
+Hapic as been developed by algoo in the context of a large client project. The lack of a tool allowing real auto-documentation of Rest API has decided us to develop Hapic.
|
|
22
|
+
|
|
23
|
+Target projects of Hapic are not "quick and dirty" but professionnally architectured projects.
|
|
24
|
+
|
|
25
|
+The separation of concerns between REST APIs layer and Business Stuff layer is in the DNA of Hapic. Hapic is *just* the HTTP Layer over your business code.
|
|
26
|
+
|
|
27
|
+## Licence
|
|
28
|
+
|
|
29
|
+Hapic is licenced under the MIT licence. You can use it in your projects, closed or open sourced.
|
|
30
|
+
|
|
31
|
+## Status, contributions
|
|
32
|
+
|
|
33
|
+Hapic source code is ready for production. Some refactoring are identified and required for maintainability, but public APIs are stable so you can rely on Hapic for your developments.
|
|
34
|
+
|
|
35
|
+Hapic is under active development, based on Algoo projects. We will answer your questions and accept merge requests if you find bugs or want to include functionnalities.
|
10
|
36
|
|
11
|
37
|
## TODO references
|
12
|
38
|
|
13
|
39
|
TODO can make reference to #X, this is github issues references.
|
|
40
|
+
|
|
41
|
+## Installation
|
|
42
|
+
|
|
43
|
+```
|
|
44
|
+virtualenv -p /usr/bin/python3 venv
|
|
45
|
+source venv/bin/activate
|
|
46
|
+python setup.py develop
|
|
47
|
+```
|
|
48
|
+
|
|
49
|
+## Give it a try
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+### A complete user API
|
|
53
|
+
|
|
54
|
+In the `example/usermanagement` directory you can find a complete example of an API allowing to manage users.
|
|
55
|
+
|
|
56
|
+Features are:
|
|
57
|
+
|
|
58
|
+- get list of all users
|
|
59
|
+- get detail of a given user
|
|
60
|
+- create a user
|
|
61
|
+- delete a user
|
|
62
|
+
|
|
63
|
+In order to test it :
|
|
64
|
+
|
|
65
|
+Install the required dependencies:
|
|
66
|
+
|
|
67
|
+```
|
|
68
|
+pip install bottle flask pyramid`
|
|
69
|
+```
|
|
70
|
+
|
|
71
|
+Run the instance you wan to test (one of the three following lines):
|
|
72
|
+
|
|
73
|
+```
|
|
74
|
+python example/usermanagement/serve_bottle.py
|
|
75
|
+python example/usermanagement/serve_flask.py
|
|
76
|
+python example/usermanagement/serve_pyramid.py
|
|
77
|
+```
|
|
78
|
+
|
|
79
|
+Features shown :
|
|
80
|
+
|
|
81
|
+- auto-generation of the documentation
|
|
82
|
+- managing parameters in the uri path
|
|
83
|
+- managing input schemas
|
|
84
|
+- managing output schema
|
|
85
|
+- management of error cases (404, 500, etc)
|
|
86
|
+- nice exception handling
|
|
87
|
+- automatic dict/object serialization
|