static2api/frontend
2025-04-15 23:33:44 +02:00
..
index.html added frontend and script examples 2025-04-15 23:33:44 +02:00
README.md added frontend and script examples 2025-04-15 23:33:44 +02:00
script.js added frontend and script examples 2025-04-15 23:33:44 +02:00

Static2API Frontend

This is a simple frontend that displays data from the Static2API application. It's designed to work with the API without requiring any changes to the container or backend.

Usage

  1. Start the Static2API application either directly or via container:

    python main.py
    

    or

    ./run_container.sh
    
  2. Open the index.html file in your browser:

    • You can use any static file server
    • Or simply open the file directly in your browser
  3. The frontend will fetch data from the following endpoints:

    • / - Root endpoint
    • /api/users - Users data
    • /api/contacts - Contacts data

CORS Support

The FastAPI application has been updated with CORS middleware to allow cross-origin requests from this frontend. This means you can:

  1. Open the HTML file directly in your browser
  2. Access the API endpoints without CORS restrictions
  3. Serve the frontend from any static file server

No additional configuration is needed for CORS support.