fastify/fastify-postgres

TypeError: fastify.register is not a function

lynxionxs opened this issue · 5 comments

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'
});

// ...

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?

Yes the docs need to be updated for that

@lynxionxs you are right! Do you want to send a pr? :)

@delvedor i don't know how to do that. You can if you want

What if you want to do an ES6 import?