Adapting project to Vercel

This commit is contained in:
Pablo Ferreiro
2022-06-04 19:41:34 +02:00
parent a66e422060
commit 230906aacf
6 changed files with 15 additions and 6 deletions

View File

@@ -6,4 +6,4 @@ COPY package.json ./
RUN yarn install
COPY . .
EXPOSE 8080
CMD [ "node", "server.js" ]
CMD [ "node", "api/index.js" ]

View File

@@ -21,7 +21,7 @@ yarn install
Now you can run the server with:
```
node server.py
node api/index.js
```
## Usage
For webserver:

View File

@@ -1,4 +1,4 @@
const Signer = require("./src/Signer")
const Signer = require("../src/Signer")
const http = require("http")
const PORT = process.env.PORT || 8080
@@ -13,7 +13,8 @@ const server = http.createServer(async (req, res) => {
}
else if (req.url === "/signature" && req.method === "POST") {
res.writeHead(200, {
"Content-Type": "application/json"
"Content-Type": "application/json",
"Cache-Control": "s-max-age=1, stale-while-revalidate" // caching stuff for vercel
});
// Get url from POST body

View File

View File

@@ -1,13 +1,13 @@
{
"name": "signtok",
"version": "1.1.1",
"version": "1.1.2",
"description": "Sign your TikTok requests easily",
"repository": "https://github.com/pablouser1/SignTok",
"author": "Pablo Ferreiro",
"license": "MIT",
"private": true,
"scripts": {
"start": "node server.js"
"start": "node api/index.js"
},
"dependencies": {
"canvas": "^2.9.1",

8
vercel.json Normal file
View File

@@ -0,0 +1,8 @@
{
"rewrites": [
{
"source": "/api/(.*)",
"destination": "/api"
}
]
}