-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (25 loc) · 772 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (25 loc) · 772 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
from flask import Flask,jsonify
from flask_restful import Api
from flask_jwt_extended import JWTManager
from resources.emp import Emp,EmpLogin
app=Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS']=True
app.config['JWT_SECRET_KEY']='coscskillup'
api=Api(app)
jwt=JWTManager(app)
@jwt.unauthorized_loader
def missing_token_callback(error):
return jsonify({
'error': 'authorization_required',
"description": "Request does not contain an access token."
}), 401
@jwt.invalid_token_loader
def invalid_token_callback(error):
return jsonify({
'error': 'invalid_token',
'message': 'Signature verification failed.'
}), 401
api.add_resource(Emp,'/emp')
api.add_resource(EmpLogin,'/login')
if __name__=='__main__':
app.run()