From 2605730b5ed70c6469ea1840405ff413449c0bd8 Mon Sep 17 00:00:00 2001 From: Dennis Keirsgieter Date: Tue, 15 Sep 2020 15:20:37 +0200 Subject: [PATCH] Update README.md I changed `const fastify = require('fastify')` in the examples to `const fastify = require('fastify')()` since that seems the (new?) and correct way to work. If i don't use that i get an error saying `TypeError: fastify.register is not a function` --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 88716f7..6daff27 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ escapeId: an utility to escape query identifiers Example: ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-mysql'), { connectionString: 'mysql://root@localhost/mysql' @@ -55,7 +55,7 @@ fastify.listen(3000, err => { Use of `mysql.query` ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-mysql'), { connectionString: 'mysql://root@localhost/mysql' @@ -79,7 +79,7 @@ As you can see there is no need to close the client, since is done internally. Async/await is supported, when register `promise` option is `true`: ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-mysql'), { promise: true,