Skip to content

Commit

Permalink
make express app compatible with vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Nov 17, 2024
1 parent ee9b611 commit cb265a8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Vercel serverless functions require the entrypoint to be a file in the root directory
import app from "@/index";
export default app;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only -r tsconfig-paths/register src/index.ts",
"build": "tsc",
"vercel-build": "echo noop",
"start": "ts-node -r tsconfig-paths/register src/index.ts",
"lint": "eslint --fix --max-warnings=0",
"prettier": "prettier \"src/**/*.{ts,json,md}\"",
Expand Down
Empty file added public/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ app.listen(port, () => {
`API documentation available at http://localhost:${port}/api-docs`
);
});

export default app;
1 change: 1 addition & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "version": 2, "rewrites": [{ "source": "/(.*)", "destination": "/api" }] }

0 comments on commit cb265a8

Please sign in to comment.