Skip to content

Commit 051554d

Browse files
authored
build: prepare for vercel (#388)
1 parent ac98dcd commit 051554d

File tree

6 files changed

+1642
-24
lines changed

6 files changed

+1642
-24
lines changed

api/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const { createNodeMiddleware, createProbot } = require("probot");
2+
3+
const app = require("../app");
4+
const probot = createProbot();
5+
const middleware = createNodeMiddleware(app, { probot });
6+
7+
/**
8+
* Redirect `GET /` to `/stats`, pass `POST /` to Probot's middleware
9+
*
10+
* @param {import('@vercel/node').NowRequest} request
11+
* @param {import('@vercel/node').NowResponse} response
12+
*/
13+
module.exports = (request, response) => {
14+
if (request.method !== "POST") {
15+
response.writeHead(302, {
16+
Location: "/stats",
17+
});
18+
response.end();
19+
return;
20+
}
21+
22+
middleware(request, response);
23+
};

server.js renamed to app.js

File renamed without changes.

0 commit comments

Comments
 (0)