From 9f5a4a05995b1778f6891827edfa96aca7da5685 Mon Sep 17 00:00:00 2001 From: Hermann_Kitio Date: Sat, 18 Apr 2026 02:58:50 +0300 Subject: [PATCH] =?UTF-8?q?fix(cors):=20ajouter=20localhost:5173=20aux=20o?= =?UTF-8?q?rigines=20autoris=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index 7305eaa..61376e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import 'dotenv/config' import { Hono } from 'hono' +import { cors } from 'hono/cors' import { serve } from '@hono/node-server' import { createNodeWebSocket } from '@hono/node-ws' import authRoutes from './routes/auth.js' @@ -12,6 +13,15 @@ import createT2LiveRoutes from './routes/t2live.js' const app = new Hono() const { upgradeWebSocket, injectWebSocket } = createNodeWebSocket({ app }) +app.use( + '*', + cors({ + origin: ['https://expria.app', 'http://localhost:5173'], + allowMethods: ['GET', 'POST', 'OPTIONS'], + allowHeaders: ['Content-Type', 'Authorization'], + }) +) + app.get('/', (c) => { return c.json({ message: 'Expria API — OK' }, 200) })