Add backend shortlinks for sharing.

Creates /api/share to mint /s/:code redirects, backed by Vercel KV with a local fallback.
This commit is contained in:
b1rdmania
2025-12-26 15:03:23 +00:00
parent f671aa3b57
commit 54136cf11c
5 changed files with 192 additions and 7 deletions
+28
View File
@@ -8,6 +8,7 @@
"name": "motif-backend",
"version": "0.1.0",
"dependencies": {
"@vercel/kv": "^3.0.0",
"cheerio": "^1.0.0-rc.12",
"cors": "^2.8.5",
"crypto": "^1.0.1",
@@ -616,6 +617,27 @@
"@types/node": "*"
}
},
"node_modules/@upstash/redis": {
"version": "1.36.0",
"resolved": "https://registry.npmjs.org/@upstash/redis/-/redis-1.36.0.tgz",
"integrity": "sha512-9zN2UV9QJGPnXfWU3yZBLVQaqqENDh7g+Y4J2vJuSxBCi9FQ0aUOtaXlzuFhnsiZvCqM+eS27ic+tgmkWUsfOg==",
"license": "MIT",
"dependencies": {
"uncrypto": "^0.1.3"
}
},
"node_modules/@vercel/kv": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@vercel/kv/-/kv-3.0.0.tgz",
"integrity": "sha512-pKT8fRnfyYk2MgvyB6fn6ipJPCdfZwiKDdw7vB+HL50rjboEBHDVBEcnwfkEpVSp2AjNtoaOUH7zG+bVC/rvSg==",
"license": "Apache-2.0",
"dependencies": {
"@upstash/redis": "^1.34.0"
},
"engines": {
"node": ">=14.6"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -1826,6 +1848,12 @@
"node": ">=14.17"
}
},
"node_modules/uncrypto": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",
"license": "MIT"
},
"node_modules/undici": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz",