This commit is contained in:
amy 2024-10-26 22:04:55 +03:30
parent 40ed4d2e27
commit f3635df333
No known key found for this signature in database
3 changed files with 22 additions and 1 deletions

View file

@ -1,5 +1,6 @@
const express = require('express') const express = require('express')
const sqlite3 = require('sqlite3') const sqlite3 = require('sqlite3')
const cors = require('cors')
const app = express() const app = express()
const db = new sqlite3.Database(':memory:'); const db = new sqlite3.Database(':memory:');
@ -12,7 +13,7 @@ db.serialize(() => {
time TEXT time TEXT
)`); )`);
}); });
app.use(cors());
app.get('/', async (req, res) => { app.get('/', async (req, res) => {
const url = req.query.url; const url = req.query.url;
@ -73,6 +74,7 @@ app.get('/', async (req, res) => {
res.status(500).send("damn"); res.status(500).send("damn");
return; return;
} }
res.
res.contentType("application/json"); res.contentType("application/json");
res.header("cache", "wasnt"); res.header("cache", "wasnt");
res.send(resp) res.send(resp)

View file

@ -10,6 +10,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"cors": "^2.8.5",
"express": "^4.21.1", "express": "^4.21.1",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"
} }

View file

@ -8,6 +8,9 @@ importers:
.: .:
dependencies: dependencies:
cors:
specifier: ^2.8.5
version: 2.8.5
express: express:
specifier: ^4.21.1 specifier: ^4.21.1
version: 4.21.1 version: 4.21.1
@ -136,6 +139,10 @@ packages:
resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==} resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
cors@2.8.5:
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
engines: {node: '>= 0.10'}
debug@2.6.9: debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies: peerDependencies:
@ -486,6 +493,10 @@ packages:
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
deprecated: This package is no longer supported. deprecated: This package is no longer supported.
object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
object-inspect@1.13.2: object-inspect@1.13.2:
resolution: {integrity: sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==} resolution: {integrity: sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -868,6 +879,11 @@ snapshots:
cookie@0.7.1: {} cookie@0.7.1: {}
cors@2.8.5:
dependencies:
object-assign: 4.1.1
vary: 1.1.2
debug@2.6.9: debug@2.6.9:
dependencies: dependencies:
ms: 2.0.0 ms: 2.0.0
@ -1275,6 +1291,8 @@ snapshots:
set-blocking: 2.0.0 set-blocking: 2.0.0
optional: true optional: true
object-assign@4.1.1: {}
object-inspect@1.13.2: {} object-inspect@1.13.2: {}
on-finished@2.4.1: on-finished@2.4.1: