From 8f01c4f60b5134b53f621398144c2eac69951afe Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 9 Mar 2024 15:34:29 +0000 Subject: [PATCH] Fix CORS, allow for client-side and cross-origin GET requests --- api/src/api.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/src/api.ts b/api/src/api.ts index 0222d07..5cc0191 100644 --- a/api/src/api.ts +++ b/api/src/api.ts @@ -1,4 +1,5 @@ import { Hono } from 'hono'; +import { cors } from 'hono/cors'; import Fuse from 'fuse.js'; import { @@ -14,6 +15,9 @@ import index from '../public/index.html' /* Create new Hono app */ const app = new Hono({ strict: false }); +/* Enable CORS for all routes */ +app.use('*', cors()); + /* Serve the index page (which contains the Swagger Docs) */ app.get("/", async (ctx) => { if (index) {