mirror of
https://github.com/SrIzan10/api.git
synced 2026-06-06 00:46:48 +00:00
fix: transcriptor errors because of lack of cors
This commit is contained in:
2
index.ts
2
index.ts
@@ -6,6 +6,7 @@ import { router } from "express-file-routing"
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { PrismaClient } from "@prisma/client"
|
import { PrismaClient } from "@prisma/client"
|
||||||
|
import cors from "cors"
|
||||||
const exec = (await import('util')).promisify((await import('child_process')).exec);
|
const exec = (await import('util')).promisify((await import('child_process')).exec);
|
||||||
|
|
||||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
@@ -27,6 +28,7 @@ app.use(express.json())
|
|||||||
app.use(express.static('public'))
|
app.use(express.static('public'))
|
||||||
app.use(limiter)
|
app.use(limiter)
|
||||||
app.disable("x-powered-by")
|
app.disable("x-powered-by")
|
||||||
|
app.use(cors())
|
||||||
|
|
||||||
router({ directory: path.join(dirname, '/routes') }).then((r) => {
|
router({ directory: path.join(dirname, '/routes') }).then((r) => {
|
||||||
app.use("/", r);
|
app.use("/", r);
|
||||||
|
|||||||
Reference in New Issue
Block a user