Home / File/ shared-schema.js — fastify Source File

shared-schema.js — fastify Source File

Architecture documentation for shared-schema.js, a javascript file in the fastify codebase.

Entity Profile

Source Code

'use strict'

const fastify = require('../fastify')({ logger: true })

fastify.addSchema({
  $id: 'https://foo/common.json',
  definitions: {
    response: {
      $id: '#reply',
      type: 'object',
      properties: {
        hello: {
          $id: '#bar',
          type: 'string'
        }
      }
    }
  }
})

const opts = {
  schema: {
    response: {
      200: { $ref: 'https://foo/common.json#reply' }
    }
  }
}

fastify
  .get('/', opts, function (req, reply) {
    reply.send({ hello: 'world' })
  })

fastify.listen({ port: 3000 }, err => {
  if (err) {
    throw err
  }
})

Frequently Asked Questions

What does shared-schema.js do?
shared-schema.js is a source file in the fastify codebase, written in javascript.
Where is shared-schema.js in the architecture?
shared-schema.js is located at examples/shared-schema.js (directory: examples).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free