Fix for vercel
This commit is contained in:
@@ -1 +1,2 @@
|
||||
node_modules
|
||||
.vercel
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/.venv
|
||||
/.vscode
|
||||
/node_modules
|
||||
/.vercel
|
||||
|
||||
17
api/index.js
17
api/index.js
@@ -6,12 +6,7 @@ const PORT = process.env.PORT || 8080
|
||||
const signer = new Signer()
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
if (req.url === "/") {
|
||||
res.writeHead(301, {
|
||||
"Location": "https://github.com/pablouser1/SignTok"
|
||||
})
|
||||
}
|
||||
else if (req.url === "/signature" && req.method === "POST") {
|
||||
if (req.method === "POST") {
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "application/json",
|
||||
"Cache-Control": "s-max-age=1, stale-while-revalidate" // caching stuff for vercel
|
||||
@@ -34,16 +29,6 @@ const server = http.createServer(async (req, res) => {
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// If no route present
|
||||
else {
|
||||
res.writeHead(404, {
|
||||
"Content-Type": "application/json"
|
||||
})
|
||||
res.write(JSON.stringify({
|
||||
message: "Route not found"
|
||||
}))
|
||||
}
|
||||
res.end()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user