forked from edisonqu/certuary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
59 lines (38 loc) · 1.25 KB
/
main.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
54
55
56
57
58
59
from flask import Flask, request
from datetime import date
from generateQR import generateQR
from pasteQR import pasteQR
from pinToIPFS import pinToIPFS
from flask_cors import CORS, cross_origin
from createCertificate import createCertificate
from verify_cid import verify_cid
app = Flask(__name__)
CORS(app, support_credentials=True)
@app.route('/')
def hello_world(): # put application's code here
return 'Hello World!'
# TODO: Deta Link, Front and Backend Integration
@app.route('/createCertificate',methods = ["POST"])
@cross_origin(supports_credentials=True)
def create_invoice():
name = request.json['name']
desc = request.json['description']
company = request.json['company']
sign = request.json['oname']
role = request.json['role']
date_issued = date.today().strftime("%B %d, %Y")
res = createCertificate(name,sign,desc,company,role)
print(res)
new = (pasteQR(res['cid']))
return new['cid']
@app.route('/verify/<CID>', methods=["GET"])
@cross_origin(supports_credentials=True)
def verify(CID):
return verify_cid(CID)
@app.route('/mint',methods=['GET'])
@cross_origin(supports_credentials=True)
def mint():
response = pinToIPFS()
return response
if __name__ == '__main__':
app.run(debug=True)