add of skills router
This commit is contained in:
1 parent
16f6048479
commit
f7a09291af
1 file changed
+19
@@ -0,0 +1,19 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
import MySQLdb
|
||||
from ..main import get_db_connection
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/api/skills")
|
||||
def read_experience_tasks():
|
||||
conn = get_db_connection()
|
||||
try:
|
||||
with conn.cursor() as cursor:
|
||||
sql = "SELECT * FROM skills;"
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return {"data": result}
|
||||
except MySQLdb.Error as e:
|
||||
raise HTTPException(status_code=500, detail=f"Erreur base de données: {e}")
|
||||
finally:
|
||||
conn.close()
|
||||
Reference in new issue
Block a user