Projekt

Obecné

Profil

Stáhnout (889 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
from flask import Flask
2
import os
3
from src.controllers.certificates_controller import CertController
4

    
5
app = Flask(__name__)
6

    
7

    
8
@app.route('/')
9
def index():
10
    return 'Welcome to the X.509 management application homepage!'
11

    
12

    
13
@app.route('/api/certificates', methods=["POST"])
14
def create_certificate():
15
    return CertController.create_certificate()
16

    
17

    
18
@app.route('/api/certificates', methods=["GET"])
19
def get_cert_list():
20
    return CertController.get_certificate_list()
21

    
22

    
23
@app.route('/api/certificates/<id>', methods=["GET"])
24
def get_cert(id):
25
    return CertController.get_certificate_by_id(id)
26

    
27

    
28
if __name__ == '__main__':
29
    host = "0.0.0.0"
30
    port = 5000
31

    
32
    # TODO better load this from config.py
33
    if "FLASK_HOST" in os.environ:
34
        host = os.environ["FLASK_HOST"]
35

    
36
    if "FLASK_PORT" in os.environ:
37
        host = os.environ["FLASK_PORT"]
38

    
39
    app.run(host=host, port=port)
(6-6/10)