Skip to content

Commit

Permalink
Merge branch 'feature/backend' of https://github.com/wtfdivyansh/plura
Browse files Browse the repository at this point in the history
…into feature/backend
  • Loading branch information
wtfdivyansh committed Nov 17, 2024
2 parents 1749865 + fc0537d commit effbb4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apps/api/app/api/[[...route]]/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { Hono } from "hono";

const app = new Hono();


app.on(["POST", "GET"], "/**", (c) => {
return auth.handler(c.req.raw);
});

export default app
export default app;
4 changes: 1 addition & 3 deletions apps/api/app/api/[[...route]]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const allowedOrigins = [

export const runtime = "edge";

const app = new Hono<{
const app = new Hono<{
Variables: {
user: typeof Auth.$Infer.Session.user | null;
session: typeof Auth.$Infer.Session.session | null;
Expand Down Expand Up @@ -59,12 +59,10 @@ app.route("/hello", hello);
app.route("/mail", mail);
app.route("/auth", auth);


const GET = handle(app);
const POST = handle(app);
const PATCH = handle(app);
const DELETE = handle(app);
const OPTIONS = handle(app);

export { GET, PATCH, POST, DELETE, OPTIONS };

5 changes: 2 additions & 3 deletions apps/api/app/api/[[...route]]/session.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Hono } from "hono";
import { auth } from "@repo/auth";
const app = new Hono()
const app = new Hono();
app.get("/", async (c) => {
const session = await auth.api.getSession({ headers: c.req.raw.headers });
const session = await auth.api.getSession({ headers: c.req.raw.headers });

if (!session) return c.json({ message: "no session found" }, 401);

Expand All @@ -18,5 +18,4 @@ app.get("/all", async (c) => {
return c.json(res);
});


export default app;

0 comments on commit effbb4d

Please sign in to comment.