UNPKG

fastify

Version:

Fast and low overhead web framework, for Node.js

30 lines (25 loc) 472 B
'use strict' const fastify = require('../fastify')() const schema = { schema: { response: { 200: { type: 'object', properties: { hello: { type: 'string' } } } } } } fastify .get('/', schema, function (req, reply) { reply .send({ hello: 'world' }) }) fastify.listen(3000, err => { if (err) throw err console.log(`server listening on ${fastify.server.address().port}`) })