File size: 385 Bytes
23ac194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict'

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

const Readable = require('node:stream').Readable

fastify
  .get('/', function (req, reply) {
    const stream = Readable.from(['hello world'])
    reply.send(stream)
  })

fastify.listen({ port: 3000 }, (err, address) => {
  if (err) {
    throw err
  }
  fastify.log.info(`server listening on ${address}`)
})