Archived
1
0

feat: Структура проекта

This commit is contained in:
2025-10-20 12:07:37 +03:00
parent 27da4d8dd6
commit 3bd6547226
27 changed files with 3884 additions and 0 deletions

25
apps/frontend/server.ts Normal file
View File

@ -0,0 +1,25 @@
import { createRequestHandler } from 'expo-server/adapter/bun';
const CLIENT_BUILD_DIR = `${process.cwd()}/dist/client`;
const SERVER_BUILD_DIR = `${process.cwd()}/dist/server`;
const handleRequest = createRequestHandler({ build: SERVER_BUILD_DIR });
const port = process.env.PORT || 3000;
Bun.serve({
port: process.env.PORT || 3000,
async fetch(req) {
const url = new URL(req.url);
console.log('Request URL:', url.pathname);
const staticPath = url.pathname === '/' ? '/index.html' : url.pathname;
const file = Bun.file(CLIENT_BUILD_DIR + staticPath);
if (await file.exists()) return new Response(await file.arrayBuffer());
return handleRequest(req);
},
});
console.log(`Bun server running at http://localhost:${port}`);