-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
34 lines (26 loc) · 961 Bytes
/
app.py
File metadata and controls
34 lines (26 loc) · 961 Bytes
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
import os
from flask import Flask,jsonify,request,send_file
from flask_restful import Api
from flask_jwt import JWT, jwt_required
from security import authenticate, identity
from flask_cors import CORS
from datetime import timedelta
from resources.user import UserRegister, User
from resources.bilag import BilagList, CreateBilag, UserBilag, Upload, Download, Test
app = Flask(__name__)
CORS(app)
app.secret_key = 'secret'
api = Api(app)
jwt = JWT(app,authenticate,identity)
# config JWT to expire within half an hour
app.config['JWT_EXPIRATION_DELTA'] = timedelta(seconds=1800)
api.add_resource(CreateBilag, '/new_bilag')
api.add_resource(BilagList, '/bilag_list')
api.add_resource(UserRegister, '/register')
api.add_resource(User, '/users')
api.add_resource(UserBilag, '/user_bilag')
api.add_resource(Upload, '/upload')
api.add_resource(Download, '/download')
api.add_resource(Test, '/test')
if __name__ == '__main__':
app.run(port=5050, debug=True)