CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
https.js39 linesDownload Raw Back to examples
1'use strict'2 3const fs = require('node:fs')4const path = require('node:path')5const fastify = require('../fastify')({6  https: {7    key: fs.readFileSync(path.join(__dirname, '../test/https/fastify.key')),8    cert: fs.readFileSync(path.join(__dirname, '../test/https/fastify.cert'))9  },10  logger: true11})12 13const opts = {14  schema: {15    response: {16      '2xx': {17        type: 'object',18        properties: {19          hello: {20            type: 'string'21          }22        }23      }24    }25  }26}27 28fastify29  .get('/', opts, function (req, reply) {30    reply.header('Content-Type', 'application/json').code(200)31    reply.send({ hello: 'world' })32  })33 34fastify.listen({ port: 3000 }, err => {35  if (err) {36    throw err37  }38})39