baraqex 1.0.76 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/README.md +268 -315
- package/bin/baraqex.js +150 -12
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2319 -205
- package/dist/browser.js.map +4 -4
- package/dist/core/batch.d.ts +10 -0
- package/dist/core/batch.d.ts.map +1 -0
- package/dist/core/component.d.ts +69 -0
- package/dist/core/component.d.ts.map +1 -0
- package/dist/core/context.d.ts +22 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/errors.d.ts +125 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/event-bus.d.ts +29 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/forms.d.ts +128 -0
- package/dist/core/forms.d.ts.map +1 -0
- package/dist/core/hooks.d.ts +84 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/jsx-runtime.d.ts +45 -0
- package/dist/core/jsx-runtime.d.ts.map +1 -0
- package/dist/core/lifecycle-events.d.ts +71 -0
- package/dist/core/lifecycle-events.d.ts.map +1 -0
- package/dist/core/renderer.d.ts +39 -0
- package/dist/core/renderer.d.ts.map +1 -0
- package/dist/core/router.d.ts +108 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/server-renderer.d.ts +26 -0
- package/dist/core/server-renderer.d.ts.map +1 -0
- package/dist/core/store.d.ts +102 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/types.d.ts +66 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/utils.d.ts +153 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/vdom.d.ts +29 -0
- package/dist/core/vdom.d.ts.map +1 -0
- package/dist/index.d.ts +39 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2596 -508
- package/dist/index.js.map +4 -4
- package/dist/server/auth.d.ts +8 -3
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +173 -112
- package/dist/server/index.js.map +4 -4
- package/dist/server/middleware.d.ts +10 -1
- package/dist/server/middleware.d.ts.map +1 -1
- package/package.json +224 -124
- package/templates/basic-app/src/main.jsx +336 -0
- package/templates/complete-app/api/hello.js +0 -0
- package/templates/complete-app/client.js +58 -0
- package/templates/complete-app/lib/frontend-hamroun.js +182 -0
- package/templates/complete-app/package.json +18 -0
- package/templates/complete-app/pages/about.js +119 -0
- package/templates/complete-app/pages/about.jsx +0 -0
- package/templates/complete-app/pages/index.js +157 -0
- package/templates/complete-app/pages/index.jsx +0 -0
- package/templates/complete-app/pages/wasm-demo.js +290 -0
- package/templates/complete-app/pages/wasm-demo.jsx +0 -0
- package/templates/complete-app/public/client.js +89 -0
- package/templates/complete-app/public/index.html +118 -0
- package/templates/complete-app/public/styles.css +76 -0
- package/templates/complete-app/readme.md +188 -0
- package/templates/complete-app/server.js +226 -0
- package/templates/complete-app/server.ts +275 -0
- package/templates/complete-app/src/App.tsx +59 -0
- package/templates/complete-app/src/client.ts +61 -0
- package/templates/complete-app/src/client.tsx +18 -0
- package/templates/complete-app/src/pages/index.tsx +51 -0
- package/templates/complete-app/src/server.ts +218 -0
- package/templates/complete-app/tsconfig.json +22 -0
- package/templates/complete-app/tsconfig.server.json +19 -0
- package/templates/complete-app/vite.config.js +57 -0
- package/templates/complete-app/vite.config.ts +30 -0
- package/templates/complete-app/wasm/build.bat +0 -0
- package/templates/complete-app/wasm/build.sh +0 -0
- package/templates/complete-app/wasm/example.go +0 -0
- package/templates/fullstack-app/README.md +37 -0
- package/templates/fullstack-app/api/hello.js +11 -0
- package/templates/fullstack-app/api/hello.ts +18 -0
- package/templates/fullstack-app/api/users/[id].ts +73 -0
- package/templates/fullstack-app/api/users/index.ts +32 -0
- package/templates/fullstack-app/build/main.css +874 -0
- package/templates/fullstack-app/build/main.css.map +7 -0
- package/templates/fullstack-app/build/main.js +967 -0
- package/templates/fullstack-app/build/main.js.map +7 -0
- package/templates/fullstack-app/build.ts +210 -0
- package/templates/fullstack-app/index.html +36 -0
- package/templates/fullstack-app/package.json +35 -0
- package/templates/fullstack-app/postcss.config.js +6 -0
- package/templates/fullstack-app/process-tailwind.js +45 -0
- package/templates/fullstack-app/public/_redirects +1 -0
- package/templates/fullstack-app/public/route-handler.js +47 -0
- package/templates/fullstack-app/public/spa-fix.html +17 -0
- package/templates/fullstack-app/public/styles.css +975 -0
- package/templates/fullstack-app/public/tailwind.css +15 -0
- package/templates/fullstack-app/server.js +267 -0
- package/templates/fullstack-app/server.ts +474 -0
- package/templates/fullstack-app/src/README.md +55 -0
- package/templates/fullstack-app/src/client.js +87 -0
- package/templates/fullstack-app/src/components/ClientHome.tsx +0 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.tsx +36 -0
- package/templates/fullstack-app/src/components/Layout.tsx +42 -0
- package/templates/fullstack-app/src/components/StateDemo.tsx +207 -0
- package/templates/fullstack-app/src/components/UserList.tsx +44 -0
- package/templates/fullstack-app/src/config.ts +42 -0
- package/templates/fullstack-app/src/data/api.ts +206 -0
- package/templates/fullstack-app/src/main.tsx +155 -0
- package/templates/fullstack-app/src/middleware.ts +28 -0
- package/templates/fullstack-app/src/pages/404.tsx +28 -0
- package/templates/fullstack-app/src/pages/[id].tsx +0 -0
- package/templates/fullstack-app/src/pages/_app.tsx +11 -0
- package/templates/fullstack-app/src/pages/_document.tsx +25 -0
- package/templates/fullstack-app/src/pages/_error.tsx +45 -0
- package/templates/fullstack-app/src/pages/about/index.tsx +67 -0
- package/templates/fullstack-app/src/pages/about.tsx +71 -0
- package/templates/fullstack-app/src/pages/api/users/[id].ts +73 -0
- package/templates/fullstack-app/src/pages/api/users/index.ts +43 -0
- package/templates/fullstack-app/src/pages/index.tsx +110 -0
- package/templates/fullstack-app/src/pages/users/[id].tsx +153 -0
- package/templates/fullstack-app/src/pages/users.tsx +60 -0
- package/templates/fullstack-app/src/pages/wasm-demo.tsx +1 -0
- package/templates/fullstack-app/src/router.ts +255 -0
- package/templates/fullstack-app/src/styles.css +5 -0
- package/templates/fullstack-app/tailwind.config.js +11 -0
- package/templates/fullstack-app/tsconfig.json +18 -0
- package/templates/fullstack-app/vite.config.js +87 -0
- package/templates/go/build.bat +36 -0
- package/templates/go/build.sh +43 -0
- package/templates/go/example.go +205 -0
- package/templates/go-wasm-app/README.md +38 -0
- package/templates/go-wasm-app/babel.config.js +21 -0
- package/templates/go-wasm-app/build-client.js +49 -0
- package/templates/go-wasm-app/build-wasm.js +237 -0
- package/templates/go-wasm-app/build.config.js +62 -0
- package/templates/go-wasm-app/build.js +218 -0
- package/templates/go-wasm-app/package.json +32 -0
- package/templates/go-wasm-app/public/index.html +128 -0
- package/templates/go-wasm-app/public/styles.css +197 -0
- package/templates/go-wasm-app/public/wasm/example.wasm +0 -0
- package/templates/go-wasm-app/public/wasm/wasm_exec.js +561 -0
- package/templates/go-wasm-app/public/wasm/wasm_exec_node.js +39 -0
- package/templates/go-wasm-app/server.js +70 -0
- package/templates/go-wasm-app/src/App.jsx +38 -0
- package/templates/go-wasm-app/src/app.js +173 -0
- package/templates/go-wasm-app/src/client.js +57 -0
- package/templates/go-wasm-app/src/components/Footer.jsx +13 -0
- package/templates/go-wasm-app/src/components/Header.jsx +19 -0
- package/templates/go-wasm-app/src/components/WasmDemo.jsx +120 -0
- package/templates/go-wasm-app/src/main.jsx +12 -0
- package/templates/go-wasm-app/src/wasm/example.go +75 -0
- package/templates/go-wasm-app/tsconfig.server.json +18 -0
- package/templates/go-wasm-app/vite.config.js +45 -0
- package/dist/forms/index.d.ts +0 -2
- package/dist/forms/index.d.ts.map +0 -1
- package/dist/forms/types.d.ts +0 -2
- package/dist/forms/types.d.ts.map +0 -1
- package/dist/frontend/components/WasmLoader.d.ts +0 -2
- package/dist/frontend/components/WasmLoader.d.ts.map +0 -1
- package/dist/frontend/hooks/useWasm.d.ts +0 -2
- package/dist/frontend/hooks/useWasm.d.ts.map +0 -1
- package/dist/frontend/index.d.ts +0 -2
- package/dist/frontend/index.d.ts.map +0 -1
- package/dist/router/index.d.ts +0 -2
- package/dist/router/index.d.ts.map +0 -1
- package/dist/router/types.d.ts +0 -2
- package/dist/router/types.d.ts.map +0 -1
- package/dist/store/index.d.ts +0 -2
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/types.d.ts +0 -2
- package/dist/store/types.d.ts.map +0 -1
- package/templates/basic-app/package-lock.json +0 -7173
- package/templates/fullstack-template/package-lock.json +0 -3558
- package/templates/ssr-template/package-lock.json +0 -5380
- package/templates/wasm/package-lock.json +0 -5347
- package/templates/wasm/public/example.wasm +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* All Tailwind directives */
|
|
2
|
+
@tailwind base;
|
|
3
|
+
@tailwind components;
|
|
4
|
+
@tailwind utilities;
|
|
5
|
+
|
|
6
|
+
/* Custom styles */
|
|
7
|
+
body {
|
|
8
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
9
|
+
line-height: 1.6;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Any custom utility classes can go here */
|
|
13
|
+
.custom-container {
|
|
14
|
+
@apply max-w-4xl mx-auto px-4 py-8;
|
|
15
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
import { createServer } from 'http';
|
|
7
|
+
import { Server as SocketServer } from 'socket.io';
|
|
8
|
+
import compression from 'compression';
|
|
9
|
+
import cors from 'cors';
|
|
10
|
+
|
|
11
|
+
// Load environment variables
|
|
12
|
+
dotenv.config();
|
|
13
|
+
|
|
14
|
+
// Get __dirname equivalent in ESM
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
|
|
18
|
+
// Create Express app
|
|
19
|
+
const app = express();
|
|
20
|
+
const PORT = process.env.PORT || 3000;
|
|
21
|
+
const httpServer = createServer(app);
|
|
22
|
+
|
|
23
|
+
// Create socket.io server
|
|
24
|
+
const io = new SocketServer(httpServer, {
|
|
25
|
+
cors: {
|
|
26
|
+
origin: process.env.NODE_ENV === 'production' ? false : '*',
|
|
27
|
+
methods: ['GET', 'POST']
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Middleware setup
|
|
32
|
+
app.use(express.json());
|
|
33
|
+
app.use(express.urlencoded({ extended: true }));
|
|
34
|
+
app.use(compression()); // Add compression for better performance
|
|
35
|
+
app.use(cors()); // Enable CORS for API access
|
|
36
|
+
|
|
37
|
+
// Add request logging in development mode
|
|
38
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
39
|
+
app.use((req, res, next) => {
|
|
40
|
+
console.log(`${new Date().toISOString()} - ${req.method} ${req.url}`);
|
|
41
|
+
next();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// For production, serve the built files
|
|
46
|
+
if (process.env.NODE_ENV === 'production') {
|
|
47
|
+
app.use(express.static(path.join(__dirname, 'dist')));
|
|
48
|
+
} else {
|
|
49
|
+
// In development, we'll let Vite handle the frontend
|
|
50
|
+
console.log('Running in development mode - Vite handles the frontend');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Global in-memory store for demo purposes
|
|
54
|
+
// In a real app, you would use a database
|
|
55
|
+
const store = {
|
|
56
|
+
users: [
|
|
57
|
+
{ id: 1, name: 'User 1', email: 'user1@example.com' },
|
|
58
|
+
{ id: 2, name: 'User 2', email: 'user2@example.com' },
|
|
59
|
+
{ id: 3, name: 'User 3', email: 'user3@example.com' }
|
|
60
|
+
],
|
|
61
|
+
posts: [
|
|
62
|
+
{ id: 1, title: 'Post 1', content: 'Content for post 1', authorId: 1 },
|
|
63
|
+
{ id: 2, title: 'Post 2', content: 'Content for post 2', authorId: 2 },
|
|
64
|
+
{ id: 3, title: 'Post 3', content: 'Content for post 3', authorId: 1 }
|
|
65
|
+
]
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Core API routes (available without file-based routing)
|
|
69
|
+
app.get('/api/hello', (req, res) => {
|
|
70
|
+
res.json({
|
|
71
|
+
message: "Hello from the API!",
|
|
72
|
+
time: new Date().toISOString(),
|
|
73
|
+
features: [
|
|
74
|
+
"Server-side rendering",
|
|
75
|
+
"API routes",
|
|
76
|
+
"Component-based UI",
|
|
77
|
+
"React-like development experience",
|
|
78
|
+
"WebSocket integration",
|
|
79
|
+
"Database connectivity",
|
|
80
|
+
"Authentication"
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// REST API endpoints for store data
|
|
86
|
+
app.get('/api/users', (req, res) => {
|
|
87
|
+
res.json(store.users);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
app.get('/api/users/:id', (req, res) => {
|
|
91
|
+
const user = store.users.find(u => u.id === parseInt(req.params.id));
|
|
92
|
+
if (user) {
|
|
93
|
+
res.json(user);
|
|
94
|
+
} else {
|
|
95
|
+
res.status(404).json({ error: 'User not found' });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
app.get('/api/posts', (req, res) => {
|
|
100
|
+
const { authorId } = req.query;
|
|
101
|
+
|
|
102
|
+
if (authorId) {
|
|
103
|
+
const filteredPosts = store.posts.filter(p => p.authorId === parseInt(authorId));
|
|
104
|
+
return res.json(filteredPosts);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
res.json(store.posts);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Improved dynamic API route loading with better error handling
|
|
111
|
+
const apiDir = path.join(__dirname, 'api');
|
|
112
|
+
if (fs.existsSync(apiDir)) {
|
|
113
|
+
console.log('Loading API routes from directory...');
|
|
114
|
+
|
|
115
|
+
// Function to map file paths to API routes
|
|
116
|
+
const registerApiRoutes = async (dir, routePrefix = '') => {
|
|
117
|
+
try {
|
|
118
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
119
|
+
|
|
120
|
+
for (const entry of entries) {
|
|
121
|
+
const fullPath = path.join(dir, entry.name);
|
|
122
|
+
|
|
123
|
+
if (entry.isDirectory()) {
|
|
124
|
+
// Process directories recursively
|
|
125
|
+
await registerApiRoutes(fullPath, `${routePrefix}/${entry.name}`);
|
|
126
|
+
} else if (entry.name.endsWith('.js') || entry.name.endsWith('.ts')) {
|
|
127
|
+
// Process API file
|
|
128
|
+
try {
|
|
129
|
+
const fileName = entry.name.replace(/\.[^/.]+$/, ""); // Remove extension
|
|
130
|
+
const routePath = fileName === 'index'
|
|
131
|
+
? routePrefix
|
|
132
|
+
: fileName.startsWith('[') && fileName.endsWith(']')
|
|
133
|
+
? `${routePrefix}/:${fileName.slice(1, -1)}` // Convert [param] to :param
|
|
134
|
+
: `${routePrefix}/${fileName}`;
|
|
135
|
+
|
|
136
|
+
// Import the route module
|
|
137
|
+
const module = await import(`file://${fullPath}`);
|
|
138
|
+
|
|
139
|
+
// Register handlers for HTTP methods
|
|
140
|
+
['get', 'post', 'put', 'delete', 'patch'].forEach(method => {
|
|
141
|
+
if (typeof module[method] === 'function') {
|
|
142
|
+
console.log(` Registered ${method.toUpperCase()} ${routePath}`);
|
|
143
|
+
app[method](`/api${routePath}`, module[method]);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Special case for 'delete' which might be named 'delete_' in some files
|
|
148
|
+
if (typeof module['delete_'] === 'function') {
|
|
149
|
+
console.log(` Registered DELETE ${routePath}`);
|
|
150
|
+
app.delete(`/api${routePath}`, module['delete_']);
|
|
151
|
+
}
|
|
152
|
+
} catch (err) {
|
|
153
|
+
console.error(`Error loading API route ${fullPath}:`, err);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch (err) {
|
|
158
|
+
console.error(`Error reading directory ${dir}:`, err);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// Start registering API routes
|
|
163
|
+
registerApiRoutes(apiDir).catch(err => {
|
|
164
|
+
console.error('Error loading API routes:', err);
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
console.log('API directory not found, skipping API route loading');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// WebSocket setup
|
|
171
|
+
io.on('connection', (socket) => {
|
|
172
|
+
console.log('Client connected:', socket.id);
|
|
173
|
+
|
|
174
|
+
// Send welcome message
|
|
175
|
+
socket.emit('welcome', {
|
|
176
|
+
message: 'Connected to WebSocket server',
|
|
177
|
+
time: new Date().toISOString()
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Handle client messages
|
|
181
|
+
socket.on('message', (data) => {
|
|
182
|
+
console.log('Received message:', data);
|
|
183
|
+
// Broadcast to all clients
|
|
184
|
+
io.emit('broadcast', {
|
|
185
|
+
from: socket.id,
|
|
186
|
+
data,
|
|
187
|
+
time: new Date().toISOString()
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Handle disconnect
|
|
192
|
+
socket.on('disconnect', () => {
|
|
193
|
+
console.log('Client disconnected:', socket.id);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// In production or if using SSR, handle all routes
|
|
198
|
+
app.get('*', (req, res, next) => {
|
|
199
|
+
// Skip API routes
|
|
200
|
+
if (req.path.startsWith('/api/')) {
|
|
201
|
+
return next();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// In production, serve the index.html
|
|
205
|
+
if (process.env.NODE_ENV === 'production') {
|
|
206
|
+
const indexPath = path.join(__dirname, 'dist', 'index.html');
|
|
207
|
+
if (fs.existsSync(indexPath)) {
|
|
208
|
+
try {
|
|
209
|
+
// Read the index.html file
|
|
210
|
+
let html = fs.readFileSync(indexPath, 'utf8');
|
|
211
|
+
|
|
212
|
+
// Create initial state for client hydration
|
|
213
|
+
const initialState = {
|
|
214
|
+
route: req.path,
|
|
215
|
+
timestamp: new Date().toISOString()
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// Inject initial state for hydration
|
|
219
|
+
html = html.replace(
|
|
220
|
+
'</head>',
|
|
221
|
+
`<script>window.__INITIAL_STATE__ = ${JSON.stringify(initialState)};</script></head>`
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
res.send(html);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error('Error serving HTML:', error);
|
|
227
|
+
res.status(500).send('Server Error');
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
res.status(404).send('Not found');
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
// In development, use Vite's dev server
|
|
234
|
+
// Instead of redirecting, proxy the request to maintain the URL path
|
|
235
|
+
// This allows Vite to handle the route properly
|
|
236
|
+
const viteDevServerUrl = 'http://localhost:5173';
|
|
237
|
+
|
|
238
|
+
// Tell the client which route to handle via response headers
|
|
239
|
+
res.setHeader('x-original-route', req.path);
|
|
240
|
+
|
|
241
|
+
// Forward the request to the Vite dev server with the original path
|
|
242
|
+
res.redirect(302, `${viteDevServerUrl}${req.path}`);
|
|
243
|
+
|
|
244
|
+
// Note: If the above still causes 404s, you can try this alternative
|
|
245
|
+
// res.redirect(302, `${viteDevServerUrl}/?_path=${encodeURIComponent(req.path)}`);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// Error handling middleware
|
|
250
|
+
app.use((err, req, res, next) => {
|
|
251
|
+
console.error('Server error:', err);
|
|
252
|
+
res.status(500).json({
|
|
253
|
+
error: process.env.NODE_ENV === 'production'
|
|
254
|
+
? 'Internal server error'
|
|
255
|
+
: err.message
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Start server
|
|
260
|
+
httpServer.listen(PORT, () => {
|
|
261
|
+
console.log(`Server running on http://localhost:${PORT}`);
|
|
262
|
+
|
|
263
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
264
|
+
console.log(`Frontend development server will run on http://localhost:5173`);
|
|
265
|
+
console.log(`Run 'npm run dev' to start both servers`);
|
|
266
|
+
}
|
|
267
|
+
});
|