forked from CMorenoStokoe/mr-game-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
30 lines (23 loc) · 822 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#This file initialises the FLask app and sets resource locations (URLs)
#Import
from flask import Flask #Flask app
from flask_restful import Api #Flask REST API
from flask_cors import CORS #For local testing
#Importing resources called by requests or startup
from resources.simulation import *
from resources.init import *
from startup.init import Start_Values
#Initialise app
app = Flask(__name__) #Flask APP
api = Api(app) #Flask REST API
CORS(app) #CORS for local testing
#Initialise data
Start_Values()
#Resource locations
api.add_resource(View_Data, '/simulation')
api.add_resource(Intervene, '/intervene')
api.add_resource(Reset, '/reset')
api.add_resource(Init_Buttons, '/init_buttons')
#Only runs if current file is main (prevents feedback loops?)
if __name__ == '__main__':
app.run(port=5000, debug=True)