feat: Init project with frontend and rudimentary authentication
This commit is contained in:
6
legalconsenthub/server/api/auth/[...].ts
Normal file
6
legalconsenthub/server/api/auth/[...].ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { auth } from "../../utils/auth";
|
||||
import {H3Event} from "h3";
|
||||
|
||||
export default defineEventHandler((event: H3Event) => {
|
||||
return auth.handler(toWebRequest(event));
|
||||
});
|
||||
3
legalconsenthub/server/tsconfig.json
Normal file
3
legalconsenthub/server/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../.nuxt/tsconfig.server.json"
|
||||
}
|
||||
11
legalconsenthub/server/utils/auth.ts
Normal file
11
legalconsenthub/server/utils/auth.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { betterAuth } from "better-auth";
|
||||
import Database from "better-sqlite3";
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: new Database("./sqlite.db"),
|
||||
emailAndPassword: { enabled: true, autoSignIn: false },
|
||||
user: { modelName: "better_auth_user" },
|
||||
session: { modelName: "better_auth_session" },
|
||||
account: { modelName: "better_auth_account" },
|
||||
verification: { modelName: "better_auth_verification" },
|
||||
});
|
||||
Reference in New Issue
Block a user