Commit 8f01c4f60b

8f01c4f60b5134b53f621398144c2eac69951afe

parent: 0720acdb7b

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-03-09 15:34 UTC

Fix CORS, allow for client-side and cross-origin GET requests

Layout: unified · split

api/src/api.ts +4
@@ -1,4 +1,5 @@
11import { Hono } from 'hono';
2import { cors } from 'hono/cors';
23import Fuse from 'fuse.js';
34
45import {
@@ -14,6 +15,9 @@ import index from '../public/index.html'
1415/* Create new Hono app */
1516const app = new Hono({ strict: false });
1617
18/* Enable CORS for all routes */
19app.use('*', cors());
20
1721/* Serve the index page (which contains the Swagger Docs) */
1822app.get("/", async (ctx) => {
1923 if (index) {