Projekt

Obecné

Profil

Stáhnout (763 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
if __name__ == '__main__':
24
    host = "0.0.0.0"
25
    port = 5000
26

    
27
    # TODO better load this from config.py
28
    if "FLASK_HOST" in os.environ:
29
        host = os.environ["FLASK_HOST"]
30

    
31
    if "FLASK_PORT" in os.environ:
32
        host = os.environ["FLASK_PORT"]
33

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