Files
bknd/docs/integration/node.mdx

34 lines
767 B
Plaintext

---
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: {
url: ":memory:"
}
};
serve(config);
```
For more information about the connection object, refer to the [Database](/usage/database) guide.
Run the application using node by executing:
```bash
node index.js
```