Skip to content

Commit

Permalink
prepare for vercel (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m authored Jan 11, 2023
1 parent 051554d commit db10102
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
.nyc_output
coverage
node_modules
node_modules
.vercel
20 changes: 1 addition & 19 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,4 @@ const { createNodeMiddleware, createProbot } = require("probot");

const app = require("../app");
const probot = createProbot();
const middleware = createNodeMiddleware(app, { probot });

/**
* Redirect `GET /` to `/stats`, pass `POST /` to Probot's middleware
*
* @param {import('@vercel/node').NowRequest} request
* @param {import('@vercel/node').NowResponse} response
*/
module.exports = (request, response) => {
if (request.method !== "POST") {
response.writeHead(302, {
Location: "/stats",
});
response.end();
return;
}

middleware(request, response);
};
module.exports = createNodeMiddleware(app, { probot });
3 changes: 3 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rewrites": [{ "source": "/", "destination": "/api" }]
}

1 comment on commit db10102

@vercel
Copy link

@vercel vercel bot commented on db10102 Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-git-main-first-timers.vercel.app
app-first-timers.vercel.app
first-timers.vercel.app

Please sign in to comment.