fix(cors): ajouter localhost:5173 aux origines autorisées
This commit is contained in:
parent
c9912e883a
commit
9f5a4a0599
1 changed files with 10 additions and 0 deletions
10
src/index.ts
10
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)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue