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