strong-tie/inbound-calls
0
1'use strict'2 3const fastify = require('../fastify')({ logger: true })4 5fastify.addSchema({6 $id: 'https://foo/common.json',7 definitions: {8 response: {9 $id: '#reply',10 type: 'object',11 properties: {12 hello: {13 $id: '#bar',14 type: 'string'15 }16 }17 }18 }19})20 21const opts = {22 schema: {23 response: {24 200: { $ref: 'https://foo/common.json#reply' }25 }26 }27}28 29fastify30 .get('/', opts, function (req, reply) {31 reply.send({ hello: 'world' })32 })33 34fastify.listen({ port: 3000 }, err => {35 if (err) {36 throw err37 }38})39 