* bskylink: scaffold service w/ initial config and schema * bskylink: implement link creation and redirects * bskylink: tidy * bskylink: tests * bskylink: tidy, add error handler * bskylink: add dockerfile * bskylink: add build * bskylink: fix some express plumbing * bskyweb: proxy fallthrough routes to link service redirects * bskyweb: build w/ link proxy * Add AASA to bskylink (#4588) --------- Co-authored-by: Hailey <me@haileyok.com>
20 lines
518 B
TypeScript
20 lines
518 B
TypeScript
import {Express} from 'express'
|
|
import {sql} from 'kysely'
|
|
|
|
import {AppContext} from '../context.js'
|
|
import {handler} from './util.js'
|
|
|
|
export default function (ctx: AppContext, app: Express) {
|
|
return app.get(
|
|
'/_health',
|
|
handler(async (_req, res) => {
|
|
const {version} = ctx.cfg.service
|
|
try {
|
|
await sql`select 1`.execute(ctx.db.db)
|
|
return res.send({version})
|
|
} catch (err) {
|
|
return res.status(503).send({version, error: 'Service Unavailable'})
|
|
}
|
|
}),
|
|
)
|
|
}
|