15await runMigrations();
1617// API routes
18app.route("/api/jobs", jobsRouter);
19app.route("/api/chat", chatRouter);
2021// Serve static files
ALX_PJ1ChatRoom.tsx2 matches
18const fetchMessages = async () => {
19try {
20const response = await fetch('/api/chat/messages');
21if (response.ok) {
22const messagesData = await response.json();
54};
5556const response = await fetch('/api/chat/messages', {
57method: 'POST',
58headers: {
ALX_PJ1JobForm.tsx1 match
2728try {
29const response = await fetch('/api/jobs', {
30method: 'POST',
31headers: {
ALX_PJ1JobBoard.tsx1 match
11const fetchJobs = async () => {
12try {
13const response = await fetch('/api/jobs');
14if (response.ok) {
15const jobsData = await response.json();
telegramBotStarterindex.ts1 match
38// This is a no-op if nothing's changed
39if (!isEndpointSet) {
40await bot.api.setWebhook(req.url, {
41secret_token: SECRET_TOKEN,
42});
untitled-6073index.ts2 matches
15await createTables();
1617// API routes
18app.route("/api/items", itemsRouter);
1920// Serve static files
untitled-6073App.tsx9 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import type { GroceryItem, CreateGroceryItem, ApiResponse } from "../../shared/types.ts";
4import GroceryItemComponent from "./GroceryItem.tsx";
5import AddItemForm from "./AddItemForm.tsx";
29setError(null);
30try {
31const response = await fetch("/api/items");
32const result: ApiResponse<GroceryItem[]> = await response.json();
33
34if (result.success && result.data) {
46const addItem = async (newItem: CreateGroceryItem) => {
47try {
48const response = await fetch("/api/items", {
49method: "POST",
50headers: { "Content-Type": "application/json" },
52});
53
54const result: ApiResponse<GroceryItem> = await response.json();
55
56if (result.success && result.data) {
66const updateItem = async (id: number, updates: Partial<GroceryItem>) => {
67try {
68const response = await fetch(`/api/items/${id}`, {
69method: "PUT",
70headers: { "Content-Type": "application/json" },
72});
73
74const result: ApiResponse<GroceryItem> = await response.json();
75
76if (result.success && result.data) {
88const deleteItem = async (id: number) => {
89try {
90const response = await fetch(`/api/items/${id}`, {
91method: "DELETE",
92});
93
94const result: ApiResponse<any> = await response.json();
95
96if (result.success) {
untitled-6073types.ts1 match
24}
2526export interface ApiResponse<T> {
27success: boolean;
28data?: T;
untitled-6073README.md7 matches
21โ โ โโโ queries.ts # Database operations
22โ โโโ routes/
23โ โ โโโ items.ts # Grocery items API routes
24โ โโโ index.ts # Main Hono server
25โโโ frontend/
34```
3536## API Endpoints
3738- `GET /api/items` - Get all grocery items
39- `POST /api/items` - Create a new item
40- `PUT /api/items/:id` - Update an item
41- `DELETE /api/items/:id` - Delete an item
4243## Getting Started
4445This app runs on Val Town. The backend serves the frontend and provides a REST API for managing grocery items.
untitled-4247README.md12 matches
53The app is automatically deployed on Val Town. Access the main endpoint to start using the expense tracker.
5455## API Endpoints
5657- `POST /api/auth/signup` - User registration
58- `POST /api/auth/login` - User login
59- `POST /api/auth/logout` - User logout
60- `GET /api/auth/me` - Get current user
61- `GET /api/transactions` - Get user transactions
62- `POST /api/transactions` - Create transaction
63- `PUT /api/transactions/:id` - Update transaction
64- `DELETE /api/transactions/:id` - Delete transaction
65- `GET /api/budgets` - Get user budgets
66- `POST /api/budgets` - Create/update budget
67- `GET /api/dashboard` - Get dashboard summary