You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
484 B
32 lines
484 B
4 years ago
|
'use strict'
|
||
|
|
||
|
const fastify = require('../fastify')({
|
||
|
logger: true
|
||
|
})
|
||
|
|
||
|
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, address) => {
|
||
|
if (err) throw err
|
||
|
fastify.log.info(`server listening on ${address}`)
|
||
|
})
|