mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
35 lines
786 B
Plaintext
35 lines
786 B
Plaintext
---
|
|
title: 'Bun'
|
|
description: 'Run bknd inside Bun'
|
|
---
|
|
import InstallBknd from '/snippets/install-bknd.mdx';
|
|
|
|
## Installation
|
|
Install bknd as a dependency:
|
|
<InstallBknd />
|
|
|
|
## Serve the API & static files
|
|
The `serve` function of the Bun adapter makes sure to also serve the static files required for
|
|
the admin panel.
|
|
|
|
``` tsx
|
|
// index.ts
|
|
import { serve } from "bknd/adapter/bun";
|
|
|
|
// if the configuration is omitted, it uses an in-memory database
|
|
serve({
|
|
connection: {
|
|
type: "libsql",
|
|
config: {
|
|
url: process.env.DB_URL!,
|
|
authToken: process.env.DB_AUTH_TOKEN!
|
|
}
|
|
}
|
|
});
|
|
```
|
|
For more information about the connection object, refer to the [Setup](/setup/introduction) guide.
|
|
|
|
Run the application using Bun by executing:
|
|
```bash
|
|
bun run index.ts
|
|
``` |