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 c9c7320
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ temp/
logs/
.env
.eslintcache
schema.graphql
schema.graphql
.vercel
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 "../src/index";
export default app;
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;
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"strict": false,
"strictNullChecks": true,
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"api/*": ["./api/*"]
}
},
"exclude": ["node_modules"]
Expand Down
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 c9c7320

Please sign in to comment.