-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.py
53 lines (43 loc) · 1.19 KB
/
backend.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import boto3
from flask import Flask, jsonify
from flask_restful import Api, Resource
from bson.objectid import ObjectId
from resource.UserResource import User
from resource.ClientResource import Client
from resource.LoginResource import Login
from resource.ClientsResource import Clients
from resource.UsersResource import Users
from resource.Ec2Resource import Ec2
from flask_web_log import Log
from flask_cors import CORS, cross_origin
from flask_jwt_extended import JWTManager
app = Flask(__name__)
app.config['JWT_SECRET_KEY'] = '!@#$giberrish123'
cors = CORS(app)
app.config['CORS_HEADERS']='Content-Type'
app.config['LOG_TYPE']='JSON'
app.config['LOG_LOCATION'] = 'logs'
app.config["CORS_SUPPORTS_CREDENTIALS"]=True
api = Api(app)
jtw = JWTManager(app)
Log(app)
api.add_resource(Login, "/login")
api.add_resource(
Client,
"/client/<string:id>",
"/client",
"/client/<string:id>",
"/client/<string:id>",
)
api.add_resource(Clients, "/clients")
api.add_resource(Users, "/user/getall")
api.add_resource(
User,
"/user/<string:id>",
"/user",
"/user/<string:id>",
"/user/<string:id>",
)
api.add_resource(Ec2, "/ec2")
if __name__ == "__main__":
app.run(debug=True)