27 const loadTemplates = async () => {
28 try {
29 const response = await fetch('/api/templates');
30 const result = await response.json();
31
62 const handleCreateProject = async (projectData: any) => {
63 try {
64 const response = await fetch('/api/projects', {
65 method: 'POST',
66 headers: { 'Content-Type': 'application/json' },
73 if (selectedTemplate) {
74 for (const taskTemplate of selectedTemplate.tasks) {
75 await fetch('/api/tasks', {
76 method: 'POST',
77 headers: { 'Content-Type': 'application/json' },
221
222 try {
223 const response = await fetch('/api/orders', {
224 method: 'POST',
225 headers: {
71 const handleStatusChange = async (taskId: string, newStatus: string) => {
72 try {
73 const response = await fetch(`/api/tasks/${taskId}/status`, {
74 method: 'PATCH',
75 headers: { 'Content-Type': 'application/json' },
90 const handlePriorityChange = async (taskId: string, newPriority: string) => {
91 try {
92 const response = await fetch(`/api/tasks/${taskId}/priority`, {
93 method: 'PATCH',
94 headers: { 'Content-Type': 'application/json' },
110 try {
111 setIsLoading(true);
112 const response = await fetch('/api/tasks', {
113 method: 'POST',
114 headers: { 'Content-Type': 'application/json' },
96 description: "JavaScript, frameworks and interactive sites",
97 duration: 3,
98 skills: ["JavaScript", "React basics", "API integration", "Modern frameworks"],
99 projects: ["Interactive website", "Web app", "E-commerce site", "Portfolio upgrade"]
100 },
14
15- `frontend/` - Customer-facing ordering interface
16- `backend/` - API endpoints and order management
17- `shared/` - Common types and utilities
18
19## Getting Started
20
21The main entry point is `backend/index.ts` which serves both the API and frontend files.
22
23## Database
27- JSON storage for order items
28
29## API Endpoints
30
31- `GET /` - Serves the main ordering page
32- `POST /api/orders` - Submit a new order
33- `GET /api/orders` - Get all orders (admin)
49 // Load projects, tasks, and stats in parallel
50 const [projectsRes, tasksRes, statsRes] = await Promise.all([
51 fetch('/api/projects'),
52 fetch('/api/tasks/my-tasks'),
53 fetch('/api/dashboard/stats')
54 ]);
55
48 const handleDemoLogin = async () => {
49 try {
50 const response = await fetch('/api/auth/demo', {
51 method: 'POST',
52 headers: { 'Content-Type': 'application/json' }
15await runMigrations();
16
17// API routes
18app.route("/api/jobs", jobs);
19app.route("/api/chat", chat);
20
21// Serve static files
17await runMigrations();
18
19// API routes
20app.route("/api/products", products);
21app.route("/api/orders", orders);
22
23// Serve static files
17โ โ โโโ queries.ts # Database query functions
18โ โโโ routes/
19โ โ โโโ jobs.ts # Job posting API routes
20โ โ โโโ chat.ts # Chat API routes
21โ โโโ index.ts # Main Hono server
22โโโ frontend/
32```
33
34## API Endpoints
35
36- `GET /api/jobs` - Get all job postings
37- `POST /api/jobs` - Create a new job posting
38- `GET /api/chat/messages` - Get chat messages
39- `POST /api/chat/messages` - Send a chat message
40
41## Getting Started