Backend

This directory contains the server-side code for the SmartRoutes application.

Structure

  • index.ts - Main entry point for the backend API
  • database/ - Database setup and query functions
  • routes/ - API route handlers

API Endpoints

Authentication

  • POST /api/auth/signup - Sign up or sign in with Gmail
  • GET /api/auth/me - Get current user information

Traffic Reports

  • POST /api/traffic/reports - Create a new traffic report
  • GET /api/traffic/reports - Get recent traffic reports
  • GET /api/traffic/reports/nearby - Get traffic reports near a location

User Location

  • POST /api/location/update - Update user's current location
  • GET /api/location/current - Get user's current location

Static Files

  • GET / - Serve the main application
  • GET /frontend/* - Serve frontend files
  • GET /shared/* - Serve shared files