updated docs on databases

This commit is contained in:
dswbx
2025-06-13 17:18:29 +02:00
parent 0710b5bf1f
commit 2239333f08
6 changed files with 160 additions and 86 deletions

View File

@@ -27,12 +27,13 @@ To serve the API, you can use the `serveLambda` function of the AWS Lambda adapt
```tsx index.mjs
import { serveLambda } from "bknd/adapter/aws";
import { libsql } from "bknd/data";
export const handler = serveLambda({
connection: {
url: process.env.DB_URL!,
authToken: process.env.DB_AUTH_TOKEN!
}
connection: libsql({
url: "libsql://your-database-url.turso.io",
authToken: "your-auth-token",
}),
});
```
Although the runtime would support database as a file, we don't recommend it. You'd need to also bundle the native dependencies which increases the deployment size and cold start time. Instead, we recommend you to use [LibSQL on Turso](/usage/database#sqlite-using-libsql-on-turso).

View File

@@ -34,8 +34,7 @@ import { serve } from "bknd/adapter/bun";
// if the configuration is omitted, it uses an in-memory database
serve({
connection: {
url: process.env.DB_URL!,
authToken: process.env.DB_AUTH_TOKEN!
url: "file:data.db"
}
});
```

View File

@@ -18,9 +18,7 @@ docker build -t bknd .
If you want to override the bknd version used, you can pass a `VERSION` build argument:
```bash
docker build --build-arg VERSION=<version> -t bknd .
````
```bash
```
## Running the Docker container
To run the Docker container, run the following command:
@@ -34,10 +32,6 @@ You can pass the same CLI arguments (see [Using the CLI](https://docs.bknd.io/cl
```bash
docker run -p 1337:1337 -e ARGS="--db-url file:/data/data.db" bknd
```
Or connect to a remote turso database:
```bash
docker run -p 1337:1337 -e ARGS="--db-url libsql://<db>.turso.io --db-token <token>" bknd
```
To mount the data directory to the host, you can use the `-v` flag:
```bash