Skip to content

imcotton/at-indirect-short

Repository files navigation

jsr:@indirect/short

jsr codecov

Web App for URL Shortener






Interface (curl)

  • create url

    curl localhost:3000 -F "url=https://example.net"
  • create with specified slug (code)

    curl localhost:3000 -F "url=https://example.net" \
                        -F "code=foobar"
  • /go/

    curl -i localhost:3000/go/foobar






Examples

Deno Deploy

  • no auth, one liner

    export { default } from 'jsr:@indirect/short@1'
  • signing auth (via: https://sign-poc.js.org)

    import { make }        from 'jsr:@indirect/short@1/deploy/deno'
    import { signingAuth } from 'jsr:@indirect/short@1/helper'
    
    export default await make({
    
        signing_nav: true,
    
        auth: signingAuth([
            // public key fingerprint - SHA256:xxxxxx
        ]),
    
    })
  • basic auth (by: https://hono.dev/docs/middleware/builtin/basic-auth)

    import { make }      from 'jsr:@indirect/short@1/deploy/deno'
    import { basicAuth } from 'jsr:@indirect/short@1/helper'
    
    export default await make({
    
        auth: basicAuth({ username: 'admin', password: 'Y0LO' }),
    
    })
  • bearer auth (by: https://hono.dev/docs/middleware/builtin/bearer-auth)

    import { make }       from 'jsr:@indirect/short@1/deploy/deno'
    import { bearerAuth } from 'jsr:@indirect/short@1/helper'
    
    export default await make({
    
        auth: bearerAuth({ token: 'foobar' }),
    
    })

Cloudflare Workers

install

npx jsr add @indirect/short@1

import

import { make } from '@indirect/short/deploy/unstable-cloudflare'

Tip

More details, please use this template repo as scaffolding.






License

AGPLv3