ShippingrevolutionApp.tsx1 match
29const loadDashboardStats = async () => {
30try {
31const response = await fetch('/api/tracking/dashboard/stats');
32const result = await response.json();
33if (result.success) {
untitled-5154README.md1 match
39## Tech Stack
4041- **Backend**: Hono (TypeScript API framework)
42- **Frontend**: React with TypeScript
43- **Database**: SQLite
untitled-1512index.ts3 matches
15await runMigrations();
1617// API routes
18app.route("/api/jobs", jobsRouter);
19app.route("/api/chat", chatRouter);
2021// Serve static files
untitled-1512ChatRoom.tsx2 matches
41const fetchMessages = async () => {
42try {
43const response = await fetch('/api/chat/messages');
44const result = await response.json();
45
6465try {
66const response = await fetch('/api/chat/messages', {
67method: 'POST',
68headers: {
untitled-1512JobBoard.tsx2 matches
16const fetchJobs = async () => {
17try {
18const response = await fetch('/api/jobs');
19const result = await response.json();
20
4243try {
44const response = await fetch(`/api/jobs/${jobId}`, {
45method: 'DELETE',
46});
townBusList.tsx1 match
18setDeletingId(id);
19try {
20const response = await fetch(`/api/buses/${id}`, {
21method: "DELETE",
22});
untitled-1512JobForm.tsx1 match
2627try {
28const response = await fetch('/api/jobs', {
29method: 'POST',
30headers: {
townBusForm.tsx1 match
2930try {
31const response = await fetch("/api/buses", {
32method: "POST",
33headers: {
19โ โ โโโ queries.ts # Database query functions
20โ โโโ routes/
21โ โ โโโ businesses.ts # Business-related API endpoints
22โ โโโ index.ts # Main Hono server entry point
23โโโ frontend/
33```
3435## API Endpoints
3637- `GET /api/businesses` - Get all posted businesses
38- `POST /api/businesses` - Post a new business
39- `DELETE /api/businesses/:id` - Delete a business post
40- `GET /api/businesses/search?q=term` - Search businesses
4142## Getting Started
untitled-1512chat.ts9 matches
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getRecentMessages, createMessage } from "../database/queries.ts";
3import type { ChatMessage, ApiResponse } from "../../shared/types.ts";
45const chat = new Hono();
9try {
10const messages = await getRecentMessages(50);
11const response: ApiResponse<ChatMessage[]> = {
12success: true,
13data: messages
15return c.json(response);
16} catch (error) {
17const response: ApiResponse<ChatMessage[]> = {
18success: false,
19error: "Failed to fetch messages"
30// Validate required fields
31if (!body.username || body.username.trim() === '') {
32const response: ApiResponse<ChatMessage> = {
33success: false,
34error: "Username is required"
3839if (!body.message || body.message.trim() === '') {
40const response: ApiResponse<ChatMessage> = {
41success: false,
42error: "Message is required"
47// Limit message length
48if (body.message.trim().length > 500) {
49const response: ApiResponse<ChatMessage> = {
50success: false,
51error: "Message too long (max 500 characters)"
56// Limit username length
57if (body.username.trim().length > 50) {
58const response: ApiResponse<ChatMessage> = {
59success: false,
60error: "Username too long (max 50 characters)"
68});
6970const response: ApiResponse<ChatMessage> = {
71success: true,
72data: newMessage
74return c.json(response, 201);
75} catch (error) {
76const response: ApiResponse<ChatMessage> = {
77success: false,
78error: "Failed to send message"