small refactorings and cleanups, improved bun/node adapter, updated docs

This commit is contained in:
dswbx
2024-12-07 18:55:02 +01:00
parent 154703f873
commit 94cc4042d3
16 changed files with 224 additions and 203 deletions

View File

@@ -1,26 +1,20 @@
// @ts-ignore somehow causes types:build issues on app
import type { CreateAppConfig } from "bknd";
// @ts-ignore somehow causes types:build issues on app
import { serve } from "bknd/adapter/bun";
import { type BunAdapterOptions, serve } from "bknd/adapter/bun";
// Actually, all it takes is the following line:
// serve();
// this is optional, if omitted, it uses an in-memory database
const config = {
const config: BunAdapterOptions = {
connection: {
type: "libsql",
config: {
url: "http://localhost:8080"
url: ":memory:"
}
}
} satisfies CreateAppConfig;
},
// this is only required to run inside the same workspace
// leave blank if you're running this from a different project
distPath: "../../app/dist"
};
Bun.serve({
port: 1337,
fetch: serve(
config,
// this is only required to run inside the same workspace
// leave blank if you're running this from a different project
"../../app/dist"
)
});
console.log("Server running at http://localhost:1337");
serve(config);