1import { Hono } from "jsr:@hono/hono";
2import { callWeatherGPT } from "./service";
3
4const app = new Hono();
5app.get("/ask", async (c) => {
36});
37
38// Mount API routes
39app.route("/api/auth", authRoutes);
40app.route("/api/products", productRoutes);
41app.route("/api/sales", salesRoutes);
42app.route("/api/dashboard", dashboardRoutes);
43
44// Mount static routes (must be last)
49 const verifyToken = async (authToken: string) => {
50 try {
51 const response = await fetch("/api/auth/verify", {
52 headers: {
53 "Authorization": `Bearer ${authToken}`
87 setError(null);
88
89 const response = await fetch("/api/auth/login", {
90 method: "POST",
91 headers: {
29 setSuccess(null);
30
31 const response = await fetch("/api/auth/register", {
32 method: "POST",
33 headers: {
19 try {
20 setLoading(true);
21 const response = await fetch("/api/sales", {
22 headers: {
23 "Authorization": `Bearer ${token}`
88 };
89
90 const response = await fetch("/api/sales", {
91 method: "POST",
92 headers: {
120 try {
121 setLoading(true);
122 const response = await fetch("/api/products", {
123 headers: {
124 "Authorization": `Bearer ${token}`
34 try {
35 setLoading(true);
36 const response = await fetch("/api/products", {
37 headers: {
38 "Authorization": `Bearer ${token}`
119 };
120
121 const response = await fetch("/api/products", {
122 method: "POST",
123 headers: {
16 const fetchStats = async () => {
17 try {
18 const response = await fetch("/api/dashboard/stats", {
19 headers: {
20 "Authorization": `Bearer ${token}`
39}
40
41export interface ApiResponse<T> {
42 success: boolean;
43 data?: T;
14## Project Structure
15
16- `/backend` - Server API and database operations
17- `/frontend` - User interface components and pages
18- `/shared` - Shared types and utilities
24## Technologies Used
25
26- Backend: Hono (API framework), SQLite (database)
27- Frontend: React, TailwindCSS
28- Shared: TypeScript for type definitions