TypeError: fastify.register is not a function
lynxionxs opened this issue · 5 comments
lynxionxs commented
When i use the example code and run node server
i get the error TypeError: fastify.register is not a function
const fastify = require('fastify');
fastify.register(require('fastify-postgres'), {
connectionString: 'postgres://postgres@127.0.0.1/testdb'
});
// ...
cemremengu commented
You need to init fastify instance first such as
const fastify = require('fastify')();
See https://www.fastify.io/docs/latest/Server/ for server options
Would you like to send a PR to update docs?
lynxionxs commented
Yes the docs need to be updated for that
delvedor commented
@lynxionxs you are right! Do you want to send a pr? :)
vallamost commented
What if you want to do an ES6 import?