mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
Enhance Deno integration documentation with installation instructions and versioning options
This commit is contained in:
@@ -4,6 +4,20 @@ description: "Run bknd inside Deno"
|
|||||||
tags: ["documentation"]
|
tags: ["documentation"]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To get started with Deno and bknd you can either install the package manually, and follow the descriptions below, or use the CLI starter:
|
||||||
|
|
||||||
|
### CLI Starter
|
||||||
|
|
||||||
|
Create a new Deno CLI starter project by running the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
deno run npm:bknd create -i deno
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual
|
||||||
|
|
||||||
Deno is fully supported as a runtime for bknd. If you plan to solely use the API, the setup is pretty straightforward.
|
Deno is fully supported as a runtime for bknd. If you plan to solely use the API, the setup is pretty straightforward.
|
||||||
|
|
||||||
```ts title="main.ts"
|
```ts title="main.ts"
|
||||||
@@ -24,7 +38,7 @@ export default {
|
|||||||
|
|
||||||
In order to also serve the static assets of the admin UI, you have 3 choices:
|
In order to also serve the static assets of the admin UI, you have 3 choices:
|
||||||
|
|
||||||
1. Use the `serveStaticViaImport` function to serve the static assets from the `bknd` package directly (requires unstable `raw-imports`).
|
1. Use the `serveStaticViaImport` function to serve the static assets from the `bknd` package directly. Requires unstable `raw-imports`, but it's the easiest way to serve the static assets.
|
||||||
2. Copy the static assets to your local project and use Hono's `serveStatic` middleware.
|
2. Copy the static assets to your local project and use Hono's `serveStatic` middleware.
|
||||||
3. Use the `adminOptions.assetsPath` property to point to a remote address with the static assets.
|
3. Use the `adminOptions.assetsPath` property to point to a remote address with the static assets.
|
||||||
|
|
||||||
@@ -55,6 +69,28 @@ export default {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In case you don't want to point your bknd dependency to the latest version, either add an `imports` section to your `deno.json` file:
|
||||||
|
|
||||||
|
```json title="deno.json"
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"bknd": "npm:bknd@<VERSION>" // [!code highlight]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Or specify the package with the version specified to the `serveStaticViaImport` function:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const app = await createRuntimeApp({
|
||||||
|
serveStatic: serveStaticViaImport({
|
||||||
|
package: "bknd@<VERSION>", // [!code highlight]
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `<VERSION>` with the version you want to use.
|
||||||
|
|
||||||
### `serveStatic` from local files
|
### `serveStatic` from local files
|
||||||
|
|
||||||
You can also serve the static assets from your local project by using Hono's `serveStatic` middleware. You can do so by copying the static assets to your local project and using the `serveStatic` middleware. First, you have to copy the static assets, by running the following command:
|
You can also serve the static assets from your local project by using Hono's `serveStatic` middleware. You can do so by copying the static assets to your local project and using the `serveStatic` middleware. First, you have to copy the static assets, by running the following command:
|
||||||
|
|||||||
Reference in New Issue
Block a user