27 lines
585 B
TypeScript
27 lines
585 B
TypeScript
import Fastify from 'fastify'
|
|
import apophisPlugin from 'apophis-fastify'
|
|
|
|
const fastify = Fastify()
|
|
|
|
// APOPHIS auto-registers @fastify/swagger
|
|
await fastify.register(apophisPlugin, {})
|
|
|
|
fastify.get('/health', {
|
|
schema: {
|
|
'x-category': 'observer',
|
|
'x-ensures': ['status:200'],
|
|
response: {
|
|
200: {
|
|
type: 'object',
|
|
properties: { status: { type: 'string' } }
|
|
}
|
|
}
|
|
}
|
|
}, async () => ({ status: 'ok' }))
|
|
|
|
await fastify.ready()
|
|
|
|
// Run contract tests
|
|
const result = await fastify.apophis.contract({ depth: 'quick' })
|
|
console.log(result.summary)
|