Adapting project to Vercel
This commit is contained in:
@@ -6,4 +6,4 @@ COPY package.json ./
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
EXPOSE 8080
|
||||
CMD [ "node", "server.js" ]
|
||||
CMD [ "node", "api/index.js" ]
|
||||
|
||||
@@ -21,7 +21,7 @@ yarn install
|
||||
|
||||
Now you can run the server with:
|
||||
```
|
||||
node server.py
|
||||
node api/index.js
|
||||
```
|
||||
## Usage
|
||||
For webserver:
|
||||
|
||||
@@ -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
|
||||
@@ -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
8
vercel.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/api/(.*)",
|
||||
"destination": "/api"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user