Skip to content

Commit 6420f4d

Browse files
committed
Updated docs
1 parent 0d18903 commit 6420f4d

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

docs/configuration.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Configuration
2+
3+
Each microservice needs a config file in yaml or json format to work with it. This configuration contain
4+
the Flask configuration of your project and the [Services](services.md).
5+
6+
a simple configuration file could be a config.yaml:
7+
8+
```yaml
9+
pyms:
10+
requests: true
11+
swagger:
12+
path: ""
13+
file: "swagger.yaml"
14+
my-ms:
15+
DEBUG: true
16+
TESTING: false
17+
APP_NAME: "Python Microservice"
18+
APPLICATION_ROOT: ""
19+
```
20+
21+
or in a config.json:
22+
23+
```json
24+
{
25+
"pyms":{
26+
"requests": true,
27+
"swagger": {
28+
"path": "",
29+
"file": "swagger.yaml"
30+
}
31+
},
32+
"my-ms": {
33+
"DEBUG": true,
34+
"TESTIN": false,
35+
"APP_NAME": "Python Microservice",
36+
"APPLICATION_ROOT": ""
37+
}
38+
}
39+
```

docs/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ PyMS, Python MicroService, is a collections of libraries, best practices and rec
44
microservices with Python.
55

66
## Index:
7-
* [Tutorials](structure.md)
7+
* [PyMS structure](structure.md)
8+
* [Configuration](configuration.md)
9+
* [Services](services.md)
10+
* [Microservice class](ms_class.md)
811
* Quick start - minimum project
912
* Structure of a microservice project
1013
* Swagger and connexion

docs/ms_class.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Microservices class
2+
3+
The class Microservice is the core of all microservices built with PyMS.
4+
5+
6+
You can create a simple microservices like:
7+
8+
```python
9+
from flask import jsonify
10+
11+
from pyms.flask.app import Microservice
12+
13+
ms = Microservice(service="my-minimal-microservice", path=__file__)
14+
app = ms.create_app()
15+
16+
17+
@app.route("/")
18+
def example():
19+
return jsonify({"main": "hello world"})
20+
21+
22+
if __name__ == '__main__':
23+
app.run()
24+
```
25+
26+
And a config file like this config.yml
27+
28+
```yaml
29+
my-minimal-microservice:
30+
APP_NAME: "Python Microservice"
31+
```
32+
33+
See more examples in TODO: add link

docs/services.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Services
2+
3+
Services are libraries, resources and extensions added to the Microservice in the configuration file.
4+
This services are created as attribute of the [Microservice class](s_class.md) to use in the code.
5+
6+
To add a service see the [configuration section](configuration.md).
7+
8+
The actual services are:
9+
10+
## Swagger / connexion
11+
Extends the Microservice with [Connexion](https://github.com/zalando/connexion)
12+
13+
## Requests
14+
Extends the [requests library](http://docs.python-requests.org/en/master/) with trace headers
15+
and parsing JSON objects

0 commit comments

Comments
 (0)