
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@gravlabs/appwrite-hono-adapter-bun
Advanced tools
This adapter allows you to run your Hono application on Appwrite's **`bun-1.0+`** runtime. **Caution:** this library is in active development and the API is subject to change.
This adapter allows you to run your Hono application on Appwrite's bun-1.0+
runtime. Caution: this library is in active development and the API is subject to change.
[!NOTE] Please carefully read the Requirements. Certain versions of this library will work with select Appwrite
bun1.0+
runtimes.
You can install it from the npm registry:
bun add hono @gravlabs/appwrite-hono-adapter-bun
Import serve
from @gravlabs/appwrite-hono-adapter-bun
and write your Hono code like usual. It supports most Hono middleware as well:
import { Hono } from "hono"
import { serve } from "@gravlabs/appwrite-hono-adapter-bun"
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-bun/serveStatic"
const app = new Hono()
app.get("/static/*", serveStatic({
root: './',
}))
app.get("/", (context) =>
context.html(`
<html>
<h1>Hello world</h1>
</html>
`),
)
export default serve(app)
Middleware that works for Hono will work with this middleware.
Use the packaged serveStatic
middleware to serve static files. It's best illustrated with an example. If your folder structure looks like so:
.
├── src
│ └── main.js // Appwrite function entry
├── static
│ ├── 1.jpg
│ └── 2.html
Your serveStatic
middleware would look like so:
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-bun/serveStatic"
app.use('/static/*', serveStatic({ root: './' }))
And with your folder structure looking like so:
.
└─ src
├─ main.js // Appwrite function entry
└─ static
├─ 1.jpg
└─ 2.html
Your serveStatic
middleware would look like so:
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-bun/serveStatic"
app.use('/static/*', serveStatic({ root: './src' }))
It's really convenient to create an Astro static site with just Appwrite functions:
Add the adapter to your astro.config.mjs
file.
import { defineConfig } from "astro/config"
import honoAstro from "hono-astro-adapter"
// https://astro.build/config
export default defineConfig({
output: "server", // or hybrid if you want to use SSR and SSG
adapter: honoAstro(),
})
Build your project using the astro build
command.
import { Hono } from "hono";
import { serve } from "@gravlabs/appwrite-hono-adapter-bun"
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-bun/serveStatic"
import { handler as ssrHandler } from "./dist/server/entry.mjs"
const app = new Hono()
app.use("/*", serveStatic({ root: "./dist/client/" }))
app.use(ssrHandler)
export default serve(app)
You can use the log
and error
functions from the runtime, as well as have access to the original req
and res
by accessing the context.env
in Hono. You can access the types from
import type { AppwriteBindings } from '@gravlabs/appwrite-hono-adapter-bun/types'
[]
Pleae check out which context methods you can use and then install the appropriate version.
Version | Supports | Doesn't Support |
---|---|---|
< 1.0.0 | res.send() res.json() res.empty() res.redirect() | res.text() res.binary() res.start() res.writeText() res.writeJson() res.writeBinary() res.end() |
>=1.0.0 || < 2.0.0 | res.send() res.text() res.json() res.empty() res.redirect() res.binary() | res.start() res.writeText() res.writeJson() res.writeBinary() res.end() |
>=2.0.0 | res.send() res.text() res.json() res.empty() res.redirect() res.binary() res.start() res.writeText() res.writeJson() res.writeBinary() res.end() |
MIT
FAQs
This adapter allows you to run your Hono application on Appwrite's **`bun-1.0+`** runtime. **Caution:** this library is in active development and the API is subject to change.
The npm package @gravlabs/appwrite-hono-adapter-bun receives a total of 0 weekly downloads. As such, @gravlabs/appwrite-hono-adapter-bun popularity was classified as not popular.
We found that @gravlabs/appwrite-hono-adapter-bun demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.