api_v1.4/microservice.py

24 lines
552 B
Python
Raw Normal View History

2023-09-26 18:55:46 -04:00
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")