~jae/dn0magik-mc

7f37069af2d249ada920f1807a27e0051cdea4a3 — Jae Lo Presti (DN0) 1 year, 8 months ago 41c0e2d
API: create basic userapi (username -> uuid) and serve it
2 files changed, 14 insertions(+), 0 deletions(-)

A src/api/userapi.py
M src/main.py
A src/api/userapi.py => src/api/userapi.py +12 -0
@@ 0,0 1,12 @@
from flask import Blueprint, jsonify

from utils.dbutils import get_uuid_from_username


user_api = Blueprint("user_api", __name__)


@user_api.route("/users/profiles/minecraft/<username>")
def userapi_profiles_minecraft(username: str):
    uuid = get_uuid_from_username(username)
    return jsonify({"uuid": uuid, "username": username})

M src/main.py => src/main.py +2 -0
@@ 1,10 1,12 @@
from flask import Flask, jsonify

from api.statusapi import status_api
from api.userapi import user_api

app = Flask(__name__)

app.register_blueprint(status_api)
app.register_blueprint(user_api)


@app.route("/")