30
31// Mount routes
32app.route("/api/jobs", jobsRoutes);
33app.route("/api/chat", chatRoutes);
34app.route("/", staticRoutes);
35
45 if (error) setError(null);
46
47 const response = await fetch('/api/chat');
48
49 if (!response.ok) {
79
80 try {
81 const response = await fetch('/api/chat', {
82 method: 'POST',
83 headers: {
1# Routes Directory
2
3This directory contains modular route handlers for the API.
4
5## Current Routes
46```
47
48This modular approach helps keep the codebase organized and maintainable as the API grows.
21 try {
22 setLoading(true);
23 const response = await fetch('/api/jobs');
24
25 if (!response.ok) {
40 const handleCreateJob = async (job: NewJobPosting) => {
41 try {
42 const response = await fetch('/api/jobs', {
43 method: 'POST',
44 headers: {
13## Project Structure
14
15- `/backend`: Server-side code with Hono API
16 - `/database`: SQLite database setup and queries
17 - `/routes`: API endpoints
18- `/frontend`: Client-side code
19 - `/components`: React components
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}`