1
|
|
|
from flask import Blueprint,jsonify |
2
|
|
|
from flask_restful import Api |
3
|
|
|
from resources.Hello import Hello |
4
|
|
|
from resources.requests import RequestResource, Request |
5
|
|
|
from resources.user import UserResource, User |
6
|
|
|
|
7
|
|
|
from resources.auth.user_auth import (UserSignup, UserLogin, UserLogoutAccess, UserLogoutRefresh, |
8
|
|
|
UserSignup, TokenRefresh, AllUsers) |
9
|
|
|
|
10
|
|
|
api_bp = Blueprint('api', __name__) |
11
|
|
|
api = Api(api_bp) |
12
|
|
|
|
13
|
|
|
#Route |
14
|
|
|
api.add_resource(Hello, '/','/Hello') |
15
|
|
|
api.add_resource(RequestResource, '/user/request','/user/request/', endpoint ="requests") |
16
|
|
|
api.add_resource(Request, '/user/request/<int:req_id>','/user/request/<int:req_id>/', endpoint ="request" ) |
17
|
|
|
api.add_resource(UserResource, '/user','/user/') |
18
|
|
|
api.add_resource(User, '/user/<int:uid>','/user/<int:uid>/') |
19
|
|
|
|
20
|
|
|
#authentication endpoints |
21
|
|
|
api.add_resource(UserSignup, '/auth/signup', '/auth/signup/') |
22
|
|
|
api.add_resource(UserLogin, '/auth/login') |
23
|
|
|
api.add_resource(UserLogoutAccess, '/auth/logout/access') |
24
|
|
|
api.add_resource(UserLogoutRefresh, '/auth/logout/refresh') |
25
|
|
|
api.add_resource(TokenRefresh, '/auth/token/refresh') |
26
|
|
|
api.add_resource(AllUsers, '/users') |
27
|
|
|
|