mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
small refactorings and cleanups, improved bun/node adapter, updated docs
This commit is contained in:
37
docs/integration/node.mdx
Normal file
37
docs/integration/node.mdx
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: 'Node'
|
||||
description: 'Run bknd inside Node'
|
||||
---
|
||||
import InstallBknd from '/snippets/install-bknd.mdx';
|
||||
|
||||
## Installation
|
||||
Install bknd as a dependency:
|
||||
<InstallBknd />
|
||||
|
||||
## Serve the API & static files
|
||||
The `serve` function of the Node adapter makes sure to also serve the static files required for
|
||||
the admin panel.
|
||||
|
||||
``` tsx
|
||||
// index.js
|
||||
import { serve } from "bknd/adapter/node";
|
||||
|
||||
// if the configuration is omitted, it uses an in-memory database
|
||||
/** @type {import("bknd/adapter/node").NodeAdapterOptions} */
|
||||
const config = {
|
||||
connection: {
|
||||
type: "libsql",
|
||||
config: {
|
||||
url: ":memory:"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
serve(config);
|
||||
```
|
||||
For more information about the connection object, refer to the [Setup](/setup) guide.
|
||||
|
||||
Run the application using node by executing:
|
||||
```bash
|
||||
node index.js
|
||||
```
|
||||
Reference in New Issue
Block a user