GithubHelp home page GithubHelp logo

importantimport / hatsu_serve Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 44 KB

🩵 Server-side middleware for automated request forwarding to Hatsu instance. [WIP]

License: GNU Affero General Public License v3.0

TypeScript 100.00%

hatsu_serve's Introduction

Hatsu Serve

Server-side middleware for automated request forwarding to Hatsu instance. [WIP]

Why

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-known
    • https://example.com/.well-known/webfinger?resource=acct:[email protected] => https://hatsu.local/.well-known/webfinger?resource=acct:[email protected]
    • https://example.com/.well-known/host-meta => https://hatsu.local/.well-known/host-meta
  • Automatically redirects to Hatsu object when Request Header Accept include application/activity+json (AS2) or application/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') })

Packages / Modules

Lume [WIP]

// import_map.json
{
  "imports": {
    "hatsu_serve/": "https://deno.land/x/hatsu_serve/",
    "lume/": "https://deno.land/x/lume/"
  }
}
// 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 })

Node

Hono [WIP]

Bun

Elysia [TODO]

License

Licensed under AGPLv3.

hatsu_serve's People

Contributors

kwaa avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.