Skip to content

Commit

Permalink
refactor(server): Update Hono import and add CORS middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
csulit committed Oct 23, 2024
1 parent e542848 commit a1be284
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"imports": {
"@clerk/backend": "npm:@clerk/backend@^1.13.9",
"@hono/clerk-auth": "npm:@hono/clerk-auth@^2.0.0",
"@hono/hono": "jsr:@hono/hono@^4.6.5",
"@std/dotenv": "jsr:@std/dotenv@^0.225.2",
"hono": "npm:hono@^4.6.6",
"postgres": "https://deno.land/x/[email protected]/mod.ts",
"zod": "npm:zod@^3.23.8"
},
Expand Down
13 changes: 6 additions & 7 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import "jsr:@std/dotenv/load";
import { type Context, Hono } from "jsr:@hono/hono";
import { type Context, Hono } from "npm:hono";
import { cors } from "npm:hono/cors";

import { dbPool } from "./config/postgres.ts";
import { getKvInstance, listenQueue, sendMessage } from "./config/deno-kv.ts";

const app = new Hono();
const kv = await getKvInstance();

app.use("*", cors({
origin: "*",
}));

app.get("/api/properties", async (c: Context) => {
using client = await dbPool.connect();
const query = c.req.query() as unknown as {
Expand Down

0 comments on commit a1be284

Please sign in to comment.