where to destroy knex connection

前端 未结 3 1849
北海茫月
北海茫月 2021-02-14 20:54

I\'m using knex with pg.

I have a project similar as following.

dbClient.js

const dbClient = require(\'knex\')({
  client: \'pg\',
  connection:          


        
3条回答
  •  盖世英雄少女心
    2021-02-14 21:38

    You probably don't usually need to explicitly call knex.destroy() – this is implied by the documentation itself saying (emphasis mine):

    If you ever need to explicitly teardown the connection pool, you may use knex.destroy([callback]).

提交回复
热议问题