22const authData: AuthRequest = { email, password };
23
24const response = await fetch('/api/auth/login', {
25method: 'POST',
26headers: {
20const checkAuthStatus = async () => {
21try {
22const response = await fetch('/api/auth/me');
23const data = await response.json();
24
43const handleLogout = async () => {
44try {
45await fetch('/api/auth/logout', { method: 'POST' });
46setUser(null);
47setState('login');
423. Navigate to the application URL to see the login/register interface
4344## API Endpoints
4546- `POST /api/auth/register` - User registration
47- `POST /api/auth/login` - User login
48- `POST /api/auth/logout` - User logout
49- `GET /api/auth/me` - Get current user info
5051## Database Schema
16Main application component that handles:
17- Form state management
18- API communication
19- URL/text detection
20- Loading and error states
41- ES6+ JavaScript
42- CSS Grid and Flexbox
43- Fetch API
44- React 18
1# Backend - TLDR This API
23The backend is built with Hono and provides API endpoints for article summarization.
45## Features
67- **URL Content Extraction**: Fetches and parses HTML content from URLs
8- **Text Summarization**: Uses OpenAI API to generate concise summaries
9- **Error Handling**: Comprehensive error handling for various failure scenarios
10- **Static File Serving**: Serves frontend assets and shared utilities
1112## API Endpoints
1314### `POST /api/summarize`
1516Summarizes article content or URL.
42```
4344### `GET /api/health`
4546Health check endpoint.
56## Environment Variables
5758- `OPENAI_API_KEY` - Required for AI summarization
5960## Error Handling
6162The API handles various error scenarios:
63- Invalid URLs or unreachable content
64- OpenAI API failures
65- Malformed requests
66- Content too short to summarize
32```
3334## API
3536Currently uses mock data for demonstration. In production, this would integrate with:
37- football-data.org (free tier available)
38- API-Football (RapidAPI)
39- Other football data providers
4062- **Backend**: Hono (TypeScript)
63- **Frontend**: React 18.2.0 + TailwindCSS
64- **Data**: Free football API
65- **Platform**: Val Town
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import type { Match, MatchesResponse, ApiResponse } from "../shared/types.ts";
45const app = new Hono();
10});
1112// Mock data for development (in production, this would come from a real API)
13const generateMockMatches = (date: string): Match[] => {
14const matches: Match[] = [
64app.get("/shared/*", c => serveFile(c.req.path, import.meta.url));
6566// API Routes
67app.get("/api/matches", async (c) => {
68const date = c.req.query("date") || new Date().toISOString().split('T')[0];
69
70try {
71// In a real app, you'd fetch from an actual API like:
72// const response = await fetch(`https://api.football-data.org/v4/matches?dateFrom=${date}&dateTo=${date}`);
73
74const matches = generateMockMatches(date);
81return c.json(response);
82} catch (error) {
83const errorResponse: ApiResponse = {
84success: false,
85error: "Failed to fetch matches"
89});
9091app.get("/api/matches/live", async (c) => {
92try {
93const allMatches = generateMockMatches(new Date().toISOString().split('T')[0]);
101return c.json(response);
102} catch (error) {
103const errorResponse: ApiResponse = {
104success: false,
105error: "Failed to fetch live matches"
5## Files
67- `types.ts` - TypeScript interfaces for API requests/responses and data structures
89## Usage
15```
1617Note: Files in this directory must work in both browser and server environments, so avoid using Deno-specific APIs.
33
34try {
35const response = await fetch(`/api/matches?date=${date}`);
36const data: MatchesResponse = await response.json();
37
sandraindex.html1 match
285</div>
286<h4 class="text-xl font-bold text-gray-800 mb-2">Emily Chen</h4>
287<p class="text-pink-500 font-semibold mb-3">Nail Technician & Spa Therapist</p>
288<p class="text-gray-600 text-sm">Specializes in nail art and spa treatments. Trained in massage therapy and relaxation techniques.</p>
289</div>