Adapting project to Vercel
This commit is contained in:
@@ -6,4 +6,4 @@ COPY package.json ./
|
|||||||
RUN yarn install
|
RUN yarn install
|
||||||
COPY . .
|
COPY . .
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD [ "node", "server.js" ]
|
CMD [ "node", "api/index.js" ]
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ yarn install
|
|||||||
|
|
||||||
Now you can run the server with:
|
Now you can run the server with:
|
||||||
```
|
```
|
||||||
node server.py
|
node api/index.js
|
||||||
```
|
```
|
||||||
## Usage
|
## Usage
|
||||||
For webserver:
|
For webserver:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const Signer = require("./src/Signer")
|
const Signer = require("../src/Signer")
|
||||||
const http = require("http")
|
const http = require("http")
|
||||||
|
|
||||||
const PORT = process.env.PORT || 8080
|
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") {
|
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
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get url from POST body
|
// Get url from POST body
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "signtok",
|
"name": "signtok",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Sign your TikTok requests easily",
|
"description": "Sign your TikTok requests easily",
|
||||||
"repository": "https://github.com/pablouser1/SignTok",
|
"repository": "https://github.com/pablouser1/SignTok",
|
||||||
"author": "Pablo Ferreiro",
|
"author": "Pablo Ferreiro",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js"
|
"start": "node api/index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"canvas": "^2.9.1",
|
"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