Fix for vercel

This commit is contained in:
Pablo Ferreiro
2022-06-04 19:54:35 +02:00
parent 230906aacf
commit f8175874d3
3 changed files with 3 additions and 16 deletions

View File

@@ -1 +1,2 @@
node_modules node_modules
.vercel

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/.venv /.venv
/.vscode /.vscode
/node_modules /node_modules
/.vercel

View File

@@ -6,12 +6,7 @@ const PORT = process.env.PORT || 8080
const signer = new Signer() const signer = new Signer()
const server = http.createServer(async (req, res) => { const server = http.createServer(async (req, res) => {
if (req.url === "/") { if (req.method === "POST") {
res.writeHead(301, {
"Location": "https://github.com/pablouser1/SignTok"
})
}
else if (req.url === "/signature" && req.method === "POST") {
res.writeHead(200, { res.writeHead(200, {
"Content-Type": "application/json", "Content-Type": "application/json",
"Cache-Control": "s-max-age=1, stale-while-revalidate" // caching stuff for vercel "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() res.end()
}) })