about summary refs log tree commit diff
path: root/bskylink/src/routes/index.ts
blob: d0122ff8bfed51446f955fab1fcee687a22c126c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {type Express} from 'express'

import {type AppContext} from '../context.js'
import {default as createShortLink} from './createShortLink.js'
import {default as health} from './health.js'
import {default as redirect} from './redirect.js'
import {default as root} from './root.js'
import {default as shortLink} from './shortLink.js'
import {default as siteAssociation} from './siteAssociation.js'

export * from './util.js'

export default function (ctx: AppContext, app: Express) {
  app = health(ctx, app) // GET /_health
  app = siteAssociation(ctx, app) // GET /.well-known/apple-app-site-association
  app = redirect(ctx, app) // GET /redirect
  app = createShortLink(ctx, app) // POST /link
  app = root(ctx, app) // GET / (redirect to bsky.app on root)
  app = shortLink(ctx, app) // GET /:linkId (should go last due to permissive matching)
  return app
}