Sai Baba
Sai Baba
BABetter Auth
Created by Sai Baba on 5/1/2025 in #help
Pending State not getting resolved
Even the preflight request returns a 204 - No Content
7 replies
BABetter Auth
Created by Sai Baba on 5/1/2025 in #help
Pending State not getting resolved
This is the main file of the backend
7 replies
BABetter Auth
Created by Sai Baba on 5/1/2025 in #help
Pending State not getting resolved
import dotenv from "dotenv"; import express, { Request, Response, NextFunction } from "express"; import cors from "cors"; import { router as contactRouter } from "./routes/contactRoute"; import { toNodeHandler } from "better-auth/node"; import { createDb } from "./db/config"; import { auth } from "./lib/auth"; import { sql } from "drizzle-orm"; dotenv.config(); const app = express(); // Middleware app.use( cors({ origin: "http://localhost:3000", methods: ["GET", "POST", "PUT", "DELETE"], credentials: true, }) ); app.use(express.json()); app.use((req: Request, res: Response, next: NextFunction) => { console.log(req.path, req.method); next(); }); export let db: Awaited<ReturnType<typeof createDb>>; async function startServer() { try { console.log("Attempting to connect to the DB..."); db = await createDb(); await db.execute(sqlSELECT 1); console.log("Connected to the DB successfully 🥳🥳"); // Set up auth routes after DB is initialized app.all("/api/auth/*", toNodeHandler(auth)); app.use("/api/contact", contactRouter); app.listen(process.env.PORT, () => { console.log("Server is running successfully too"); }); } catch (error) { console.error("Failed to start server:", error); process.exit(1); } } startServer();
7 replies
BABetter Auth
Created by Sai Baba on 5/1/2025 in #help
Pending State not getting resolved
No description
7 replies
BABetter Auth
Created by Sai Baba on 5/1/2025 in #help
Pending State not getting resolved
Update: It is the same for login method too
7 replies
BABetter Auth
Created by lonelyplanet on 3/28/2025 in #help
Betterauth CLI Fails on sqlite
No description
19 replies