Allow cors from v2

This commit is contained in:
Araozu 2024-02-29 14:37:37 -05:00
parent c27c2fd3fe
commit 9f9378d793
3 changed files with 32 additions and 2 deletions

View File

@ -1,10 +1,13 @@
import express from 'express'; import express from "express";
import * as core from "express-serve-static-core"; import * as core from "express-serve-static-core";
import Database from 'better-sqlite3'; import Database from "better-sqlite3";
import cors from "cors";
const app = express(); const app = express();
const port = 3485; const port = 3485;
app.use(cors());
const expressApp = (app: core.Express) => { const expressApp = (app: core.Express) => {
app.use(express.json()); app.use(express.json());

View File

@ -11,11 +11,13 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"better-sqlite3": "^9.4.3", "better-sqlite3": "^9.4.3",
"cors": "^2.8.5",
"express": "^4.18.3", "express": "^4.18.3",
"yaml": "^2.4.0" "yaml": "^2.4.0"
}, },
"devDependencies": { "devDependencies": {
"@types/better-sqlite3": "^7.6.9", "@types/better-sqlite3": "^7.6.9",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.20", "@types/express": "^4.17.20",
"@types/node": "^16.11.45", "@types/node": "^16.11.45",
"typescript": "~4.7.4" "typescript": "~4.7.4"

View File

@ -8,6 +8,9 @@ dependencies:
better-sqlite3: better-sqlite3:
specifier: ^9.4.3 specifier: ^9.4.3
version: 9.4.3 version: 9.4.3
cors:
specifier: ^2.8.5
version: 2.8.5
express: express:
specifier: ^4.18.3 specifier: ^4.18.3
version: 4.18.3 version: 4.18.3
@ -19,6 +22,9 @@ devDependencies:
'@types/better-sqlite3': '@types/better-sqlite3':
specifier: ^7.6.9 specifier: ^7.6.9
version: 7.6.9 version: 7.6.9
'@types/cors':
specifier: ^2.8.17
version: 2.8.17
'@types/express': '@types/express':
specifier: ^4.17.20 specifier: ^4.17.20
version: 4.17.21 version: 4.17.21
@ -50,6 +56,12 @@ packages:
'@types/node': 16.18.86 '@types/node': 16.18.86
dev: true dev: true
/@types/cors@2.8.17:
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
dependencies:
'@types/node': 16.18.86
dev: true
/@types/express-serve-static-core@4.17.43: /@types/express-serve-static-core@4.17.43:
resolution: {integrity: sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==} resolution: {integrity: sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==}
dependencies: dependencies:
@ -213,6 +225,14 @@ packages:
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dev: false dev: false
/cors@2.8.5:
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
engines: {node: '>= 0.10'}
dependencies:
object-assign: 4.1.1
vary: 1.1.2
dev: false
/debug@2.6.9: /debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies: peerDependencies:
@ -533,6 +553,11 @@ packages:
semver: 7.6.0 semver: 7.6.0
dev: false dev: false
/object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
dev: false
/object-inspect@1.13.1: /object-inspect@1.13.1:
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
dev: false dev: false