macbook 에서 리눅스로 이동
This commit is contained in:
5
backend/.gitignore
vendored
Normal file
5
backend/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.DS_Store
|
||||
.env
|
||||
.env.local
|
||||
node_modules/
|
||||
*.db
|
||||
15
backend/README.md
Normal file
15
backend/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# backend
|
||||
|
||||
# Setup
|
||||
|
||||
Follow these steps to run [Elysia.js](https://elysiajs.com) under [Bun](https://bun.sh):
|
||||
|
||||
1. Download packages
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
2. You're ready to go!
|
||||
```bash
|
||||
bun run main.ts
|
||||
```
|
||||
|
||||
24
backend/main.ts
Normal file
24
backend/main.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Elysia } from "elysia";
|
||||
import cors from "@elysiajs/cors";
|
||||
|
||||
const app = new Elysia().use(
|
||||
cors({
|
||||
origin: ["http://127.0.0.1:3000", "http://localhost:3000"],
|
||||
credentials: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.get("/", () => ({
|
||||
service: "landing-backend",
|
||||
status: "ok",
|
||||
}));
|
||||
|
||||
app.get("/health", () => ({
|
||||
status: "ok",
|
||||
}));
|
||||
|
||||
const port = Number(process.env.PORT ?? 4000);
|
||||
const hostname = process.env.HOST ?? "127.0.0.1";
|
||||
const server = app.listen({ port, hostname });
|
||||
|
||||
console.log(`Backend listening on ${server.server!.url}`);
|
||||
18
backend/package.json
Normal file
18
backend/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run main.ts",
|
||||
"start": "bun run main.ts",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"packageManager": "bun@1.3.9",
|
||||
"devDependencies": {
|
||||
"@types/bun": "1",
|
||||
"typescript": "5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elysiajs/cors": "^1.2.1",
|
||||
"elysia": "1"
|
||||
}
|
||||
}
|
||||
20
backend/tsconfig.json
Normal file
20
backend/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"ESNext"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleDetection": "force",
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noEmit": true,
|
||||
"types": [
|
||||
"bun-types" // add Bun global
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user