Chapter 11: update example microservice
This commit is contained in:
@@ -23,4 +23,5 @@ If you need to share functionality between services, place that
|
||||
functionality into the `plugins` folder, and share it via
|
||||
[decorators](https://www.fastify.io/docs/latest/Decorators/).
|
||||
|
||||
If you have a bit confused about using `async/await` write services, you would better take a look at [Promise resolution](https://github.com/fastify/fastify/blob/master/docs/Routes.md#promise-resolution) for more details.
|
||||
If you're a bit confused about using `async/await` to write services, you would
|
||||
better take a look at [Promise resolution](https://www.fastify.io/docs/latest/Routes/#promise-resolution) for more details.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = async function (fastify, opts) {
|
||||
fastify.get('/', async function (request, reply) {
|
||||
return 'this is an example'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = async function (fastify, opts) {
|
||||
fastify.get('/', async function (request, reply) {
|
||||
return { root: true }
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user