正确输入所有数据后如何结束我的异步连接?
即使在循环外声明连接结束,结构也在第一次 INSERT 之后完成
代码
require('es6-promise').polyfill();
require('isomorphic-fetch');
let queryAPI = {
"query": `{
squads {
name
cards(includedOnKanban: true, closed: false, archived: false, cancelled: false, swimlaneName:\"Atividades Nao Transacionais\", updatedSince: \"2020-01-01T00:00:00-0300\") {
identifier
title
description
status
priority
assignees {
fullname
}
swimlane
workstate
}
}
}`
};
(async () => {
const rawResponse = await fetch('https://www.bluesight.io/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Bluesight-API-Token': 'token-here'
},
body: JSON.stringify(queryAPI)
});
const content = await rawResponse.json();
const { Client } = require('pg');
const client = new Client({
user: 'postgres',
host: '127.0.0.1',
database: 'postgres',
password: 'postgres',
port: 5432
})
输出
错误:连接在连接处终止。(C:\Users\TESTE\Documents\Autoportal\api\node_modules\pg\lib\client.js:254:9) 在 Object.onceWrapper (events.js:417:28) 在 Connection.emit (events.js: 323:22)
浮云间
相关分类