diff --git a/.gitignore b/.gitignore index 37b9471..dab550b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ node_modules # local env files .env*.local +.vercel diff --git a/src/config/db.ts b/api/config/db.ts similarity index 90% rename from src/config/db.ts rename to api/config/db.ts index d4e2200..23cd1b8 100644 --- a/src/config/db.ts +++ b/api/config/db.ts @@ -10,7 +10,7 @@ const connectToDatabase = async (): Promise => { } const client = await MongoClient.connect(process.env.MONGODB_URI); - cachedDb = await client.db("main"); + cachedDb = client.db("main"); return cachedDb; }; diff --git a/src/index.ts b/api/index.ts similarity index 100% rename from src/index.ts rename to api/index.ts diff --git a/src/types/index.ts b/api/types/index.ts similarity index 100% rename from src/types/index.ts rename to api/types/index.ts diff --git a/src/utils/downloadFile.ts b/api/utils/downloadFile.ts similarity index 100% rename from src/utils/downloadFile.ts rename to api/utils/downloadFile.ts diff --git a/src/utils/extractZipFile.ts b/api/utils/extractZipFile.ts similarity index 100% rename from src/utils/extractZipFile.ts rename to api/utils/extractZipFile.ts diff --git a/package.json b/package.json index 234d3f6..c55893f 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,8 @@ "type": "module", "scripts": { "dev": "sst dev --stage development", - "build": "sst build", - "deploy": "sst deploy", - "remove": "sst remove", - "console": "sst console", + "start": "vercel dev", + "deploy": "vercel", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/tsconfig.json b/tsconfig.json index 4d3c77f..cb98f5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,13 @@ { "compilerOptions": { "lib": ["esnext"], - "types": ["@cloudflare/workers-types"] + "types": ["@cloudflare/workers-types"], + // TODO: For temporary Vercel deployment; remove after migrated successfully to CF Workers + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "strict": false } } diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..fe7a27e --- /dev/null +++ b/vercel.json @@ -0,0 +1,9 @@ +{ + "regions": ["sin1"], + "rewrites": [ + { + "source": "/api/(.*)", + "destination": "/api" + } + ] +}