Skip to content

Commit

Permalink
Adapting project to Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
pablouser1 committed Jun 4, 2022
1 parent a66e422 commit 230906a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY package.json ./
RUN yarn install
COPY . .
EXPOSE 8080
CMD [ "node", "server.js" ]
CMD [ "node", "api/index.js" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ yarn install

Now you can run the server with:
```
node server.py
node api/index.js
```
## Usage
For webserver:
Expand Down
5 changes: 3 additions & 2 deletions server.js → api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Signer = require("./src/Signer")
const Signer = require("../src/Signer")
const http = require("http")

const PORT = process.env.PORT || 8080
Expand All @@ -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
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 8 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rewrites": [
{
"source": "/api/(.*)",
"destination": "/api"
}
]
}

0 comments on commit 230906a

Please sign in to comment.