In order to also serve the static assets of the admin UI, you have 3 choices:
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.
Copy the static assets to your local project and use Hono's serveStatic middleware.
Use the adminOptions.assetsPath property to point to a remote address with the static assets.
The serveStaticViaImport function is a middleware that serves the static assets from the bknd package directly using dynamic raw imports. It requires the unstable raw-imports feature to be enabled. You can enable it by adding the following to your deno.json:
deno.json
{ "unstable": ["raw-imports"]}
Or by using the --unstable-raw-imports flag when running your script. Now create a main.ts file to serve the API and static assets:
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:
deno run npm:bknd copy-assets --out public
This will copy the static assets to the public directory and then serve them from there:
You can also use the adminOptions.assetsPath property to point to a remote address with the static assets. This is useful in case none of the other methods work for you.