Skip to content

Commit 9340c5c

Browse files
refactor: Transferred API from pnpm to Bun
fix: Resolved TypeScript build errors fix: Resolved environment error by using "import "dotenv/config" instead of dotenv.config() feat: Implemented t3/env package for TypeScript in environment Signed-off-by: Treasure Alekhojie <[email protected]>
1 parent 1755827 commit 9340c5c

File tree

11 files changed

+81
-1697
lines changed

11 files changed

+81
-1697
lines changed

build/db/db.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

build/db/db.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/index.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

build/index.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/tsconfig.tsbuildinfo

Lines changed: 0 additions & 1 deletion
This file was deleted.

bun.lockb

68.5 KB
Binary file not shown.

src/index.ts renamed to index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import express, { Express, urlencoded, json } from "express";
1+
import express, { type Express, urlencoded, json } from "express";
2+
import { env } from "./src/env";
23
import cors from "cors";
3-
import { Response } from "express";
4+
import { type Response } from "express";
45
import bodyParser from "body-parser";
5-
import dotenv from "dotenv";
6-
import dbJSON from "./db/db.js";
7-
8-
dotenv.config();
6+
import "dotenv/config";
7+
import dbJSON from "./src/db/db";
98

109
const allowedOrigins = ["http://localhost:3000"];
1110
const corsOptions = {
@@ -18,7 +17,7 @@ app.use(cors(corsOptions));
1817
app.use(json({ limit: "500kb" }));
1918
app.use(urlencoded({ limit: "500kb", extended: true }));
2019
app.use(bodyParser.urlencoded({ limit: "500kb", extended: false }));
21-
const port = process.env.PORT;
20+
const port = env.PORT;
2221

2322
if (!port) throw new Error("Port not found");
2423

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "module",
88
"scripts": {
99
"build": "npx tsc",
10-
"start": "node build/index.js",
10+
"start": "bun run --watch index.ts",
1111
"dev": "concurrently \"npx tsc --watch\" \"nodemon -q build/index.js\""
1212
},
1313
"keywords": [
@@ -21,6 +21,7 @@
2121
"license": "MIT",
2222
"dependencies": {
2323
"@supabase/supabase-js": "^2.39.7",
24+
"@t3-oss/env-core": "^0.10.1",
2425
"@types/express-serve-static-core": "^4.17.43",
2526
"axios": "^1.6.7",
2627
"body-parser": "^1.20.2",
@@ -29,9 +30,11 @@
2930
"express": "^4.18.2",
3031
"express-rate-limit": "^7.1.5",
3132
"mongodb": "^6.3.0",
32-
"uuid": "^9.0.1"
33+
"uuid": "^9.0.1",
34+
"zod": "^3.23.8"
3335
},
3436
"devDependencies": {
37+
"@types/bun": "latest",
3538
"@types/bcrypt": "^5.0.2",
3639
"@types/body-parser": "^1.19.5",
3740
"@types/cors": "^2.8.17",
@@ -40,7 +43,9 @@
4043
"@types/qs": "^6.9.11",
4144
"@types/uuid": "^9.0.8",
4245
"concurrently": "^8.2.2",
43-
"nodemon": "^3.1.0",
44-
"typescript": "^5.3.3"
46+
"nodemon": "^3.1.0"
47+
},
48+
"peerDependencies": {
49+
"typescript": "^5.0.0"
4550
}
46-
}
51+
}

0 commit comments

Comments
 (0)