24 lines
552 B
Python
24 lines
552 B
Python
import datetime
|
|
|
|
import flask
|
|
import json
|
|
from pathlib import Path
|
|
from flasgger import LazyJSONEncoder, Swagger
|
|
from flask import Response
|
|
from flask_restful import Api
|
|
import threading
|
|
|
|
app = flask.Flask('cerc_api')
|
|
app.json_provider_class = LazyJSONEncoder
|
|
api = Api(app)
|
|
|
|
# Parse and register services.json
|
|
|
|
services_json_path = "./configs/services.json"
|
|
|
|
for service in json.load(open(services_json_path)):
|
|
print(f"service: {service}")
|
|
api.add_resource(service["name"], service["endpoint"])
|
|
|
|
app.run(port=5000, debug=True, host="0.0.0.0")
|