init: test live deployment

This commit is contained in:
2026-02-10 01:37:15 +05:30
parent fc87ad1658
commit 1f1454b652
18 changed files with 878 additions and 216 deletions

View File

@@ -5,27 +5,39 @@ import { registerLocalMediaAdapter } from "bknd/adapter/node";
const local = registerLocalMediaAdapter();
// --------------------- SCHEMA -----------------------
// this just for testing
const schema = em({
todos: entity("todos", {
title: text(),
done: boolean(),
}),
post:entity("posts",{
title: text(),
content: text(),
})
});
// --------------------- SCHEMA END -----------------------
// register your schema to get automatic type completion
type Database = (typeof schema)["DB"];
declare module "bknd" {
interface DB extends Database {}
}
export default {
connection: {
url: "data.db",
url: process.env.DB_URL ?? "file:data.db",
},
options: {
// the seed option is only executed if the database was empty
seed: async (ctx) => {
// create some entries
await ctx.em.mutator("todos").insertMany([
{ title: "Learn bknd", done: true },
{ title: "Build something cool", done: false },
]);
// and create a user
await ctx.app.module.auth.createUser({
email: "test@bknd.io",
password: "12345678",
});
},
},
options: {},
config: {
data: schema.toJSON(),
auth: { enabled: true },