feat: Complete backend API setup with registration endpoint
- Added user registration endpoint (/api/v1/auth/register) - Created MongoDB database connection module - Fixed user models to match frontend signup form - Exposed backend port 8000 for development - Configured Vite proxy for API requests - Successfully tested user registration flow Backend is now fully functional with: - MongoDB connection - User registration with password hashing - JWT token generation - Proper error handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
20
oauth/backend/app/db/mongodb.py
Normal file
20
oauth/backend/app/db/mongodb.py
Normal file
@ -0,0 +1,20 @@
|
||||
import os
|
||||
from motor.motor_asyncio import AsyncIOMotorClient
|
||||
from typing import Optional
|
||||
|
||||
mongodb_client: Optional[AsyncIOMotorClient] = None
|
||||
database = None
|
||||
|
||||
async def connect_to_mongo():
|
||||
global mongodb_client, database
|
||||
mongodb_url = os.getenv("MONGODB_URL", "mongodb://localhost:27017")
|
||||
mongodb_client = AsyncIOMotorClient(mongodb_url)
|
||||
database = mongodb_client.oauth_db
|
||||
|
||||
async def close_mongo_connection():
|
||||
global mongodb_client
|
||||
if mongodb_client:
|
||||
mongodb_client.close()
|
||||
|
||||
async def get_database():
|
||||
return database
|
||||
Reference in New Issue
Block a user