Fixed endpoint urls

This commit is contained in:
Administrator 2022-03-14 07:35:26 +01:00
parent 00921dc505
commit 6cbef534de
2 changed files with 6 additions and 6 deletions

View File

@ -6,11 +6,11 @@ from db import db
from helper_functions import check_password, hash_password from helper_functions import check_password, hash_password
from models import User from models import User
api = Blueprint('api', __name__, url_prefix='/api/v1/resources/devices') api = Blueprint('api', __name__, url_prefix='/api')
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
@api.route('/api/users', methods=['GET']) @api.route('/users', methods=['GET'])
def users(): def users():
res = [] res = []
for i in User.query.all(): for i in User.query.all():
@ -19,7 +19,7 @@ def users():
return jsonify(res) return jsonify(res)
@api.route('/api/login', methods=['POST']) @api.route('/login', methods=['POST'])
def login(): def login():
request_data = request.get_json() request_data = request.get_json()
username = request_data['username'] username = request_data['username']
@ -32,13 +32,13 @@ def login():
return False return False
@api.route('/api/logout', methods=['GET']) @api.route('/logout', methods=['GET'])
def logout(): def logout():
# TODO # TODO
pass pass
@api.route('/api/register', methods=['POST']) @api.route('/register', methods=['POST'])
def register(): def register():
request_data = request.get_json() request_data = request.get_json()
username = request_data['username'] username = request_data['username']

View File

@ -2,7 +2,7 @@ import os
from flask import Blueprint from flask import Blueprint
interface = Blueprint('interface', __name__, url_prefix='/api/v1/resources/devices') interface = Blueprint('interface', __name__, url_prefix='/')
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))