Server-side middleware for automated request forwarding to Hatsu instance. [WIP]
Hatsu requires the target site to redirects .well-known.
While you can do this by _redirects, netlify.toml, or vercel.json, Hatsu Serve can go further:
- Automatically redirects
.well-knownhttps://example.com/.well-known/webfinger?resource=acct:example.com@example.com=>https://hatsu.local/.well-known/webfinger?resource=acct:example.com@example.comhttps://example.com/.well-known/host-meta=>https://hatsu.local/.well-known/host-meta
- Automatically redirects to Hatsu object when Request Header
Acceptincludeapplication/activity+json(AS2) orapplication/ld+json(JSON-LD)https://example.com/hello-world=>https://hatsu.local/o/https://example.com/hello-world
hatsuServe({ from: new URL('https://example.com'), to: new URL('https://hatsu.local') })Lume [WIP]
// serve.ts
import Server from 'lume/core/server.ts'
import hatsuServe from 'hatsu_serve/lume/middleware.ts'
const server = new Server({
port: 8000,
root: `${Deno.cwd()}/_site`,
})
server.use(hatsuServe({ to: new URL('https://hatsu.local') }))
server.start()Hono [WIP]
// import_map.json
{
"imports": {
"hatsu_serve/": "https://deno.land/x/hatsu_serve/",
"hono/": "https://deno.land/x/hono/"
}
}// serve.ts
import { Hono } from 'hono'
import { serveStatic } from 'hono/middleware.ts'
import { hatsuServe } from 'hatsu_serve/hono/middleware.ts'
const app = new Hono()
app.use('*', hatsuServe({ to: new URL('https://hatsu.local') }))
app.get('*', serveStatic({ root: './dist' }))
Deno.serve(app.fetch, { port: 8000 })Licensed under AGPLv3.