UNPKG

484 BJavaScriptView Raw
1'use strict'
2
3const fastify = require('../fastify')({
4 logger: true
5})
6
7const schema = {
8 schema: {
9 response: {
10 200: {
11 type: 'object',
12 properties: {
13 hello: {
14 type: 'string'
15 }
16 }
17 }
18 }
19 }
20}
21
22fastify
23 .get('/', schema, function (req, reply) {
24 reply
25 .send({ hello: 'world' })
26 })
27
28fastify.listen(3000, (err, address) => {
29 if (err) throw err
30 fastify.log.info(`server listening on ${address}`)
31})