UNPKG

385 BJavaScriptView Raw
1'use strict'
2
3const fastify = require('../fastify')({
4 logger: false
5})
6
7const Readable = require('node:stream').Readable
8
9fastify
10 .get('/', function (req, reply) {
11 const stream = Readable.from(['hello world'])
12 reply.send(stream)
13 })
14
15fastify.listen({ port: 3000 }, (err, address) => {
16 if (err) {
17 throw err
18 }
19 fastify.log.info(`server listening on ${address}`)
20})