fix(cors): ajouter localhost:5173 aux origines autorisées

This commit is contained in:
Hermann_Kitio 2026-04-18 02:58:50 +03:00
parent c9912e883a
commit 9f5a4a0599

View file

@ -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)
})