Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.04 KB

File metadata and controls

64 lines (48 loc) · 2.04 KB

Route Organization Update

Overview

The routes have been reorganized to provide clear separation between frontend and API backend functionality, along with groundwork for an admin panel.

Route Structure

Frontend Routes

  • / - Main homepage with URL shortener interface

Public API Routes (No Authentication Required)

  • /api/health_check - Health check endpoint
  • /api/redirect/{id} - Redirect to original URL

Protected API Routes (Requires API Key)

  • /api/shorten - Create shortened URLs (requires x-api-key header)

Protected Admin Routes (Requires API Key)

  • /admin - Admin dashboard
  • /admin/profile - User profile management
  • /admin/login - Login page
  • /admin/register - Registration page

Static Assets

  • /static/* - CSS, JavaScript, and other static files

Authentication

API Key Protection

Routes under /api/shorten and /admin/* are protected by API key middleware. Include the API key in the x-api-key header:

x-api-key: your-api-key-uuid

User Authentication (Future Implementation)

The admin routes provide the groundwork for future user authentication implementation. Currently, they serve HTML pages but will need backend user management functionality.

Key Changes

  1. Clear Separation: Frontend served from / with API routes under /api/
  2. Maintained Protection: /shorten route remains protected by API key
  3. Admin Foundation: New /admin/ routes for user profiles and management
  4. Consistent Structure: All related routes grouped logically

Templates Added

  • admin.html - Admin dashboard
  • profile.html - User profile management
  • login.html - User login form
  • register.html - User registration form

CSS Enhancements

Added comprehensive styling for:

  • Admin panel layout
  • User profile interface
  • Authentication forms
  • Responsive design for mobile devices

Future Enhancements

  1. User registration and authentication backend
  2. Database schema for user management
  3. Session management
  4. User-specific URL tracking
  5. Analytics and reporting features