api.py 672 Bytes
Newer Older
1 2 3 4 5
from flask import Flask
from flask_restful import Api
from endpoints.hello import HelloWorld
from endpoints.clients import Client, ClientList
from endpoints.receive import Receive
6 7
from endpoints.send import Send
from endpoints.notify import Notify
8
from flask_cors import CORS
9 10 11

app = Flask(__name__)
api = Api(app)
12
CORS(app, resources={r"*": {"origins": "http://localhost:8086"}})
13 14 15 16 17

api.add_resource(HelloWorld, "/")
api.add_resource(ClientList, "/client")
api.add_resource(Client, "/client/<client_id>")
api.add_resource(Receive, "/receive")
18 19
api.add_resource(Send, "/send")
api.add_resource(Notify, "/notify")
20 21

if __name__ == "__main__":
22
    app.run(debug=True, port=8087)