1
혼란 스럽습니다.내보내기 모듈 값
module.exports = {
connection: 'freshairMysqlServer',
tableName: 'Accounts',
autoCreatedAt: false,
autoUpdatedAt: false,
autoPK: false,
attributes: {
idAccounts: {
type: 'integer',
primaryKey: true
},
AccountName: {
type: 'string'
},
idOrganization: {
type: 'integer'
}
},
GetAccounts: function (page, cb) {
Accounts.query('SELECT Accounts.AccountName as AccountName,' +
' Organizations.Name as Organization FROM Accounts' +
' JOIN Organizations on Accounts.idOrganization = Organizations.idOrganizations',
function (err, results) {
if (err) cb(err)
else cb(null, results);
});
}
}
모듈은 자바 스크립트 객체, {..., TABLENAME : ... ... 연결을} 수출 : 나는 다음과 같은 자바 스크립트 파일이 있습니다. 이 값은 Sails에서 워터 라인 모델 객체를 확장하는 데 사용됩니다.
동일하게 수행하는 TypeScript 코드는 무엇입니까? 몇 가지 변형을 시도했지만 그것을 얻는 것 같지 않습니다. 도움! 감사.
컴파일해야합니다. 감사. –
아니, 작동하지 않습니다. 나는 잘못된 파일을 테스트하고 있었다. 이 쿼리는 Typescript 버전에서 서버 오류를 반환합니다. –
방금 확인했습니다. 제안 된 솔루션에 대한 모듈의 값은 원래 모듈의 값과 같습니다. 원래 모듈이 작동하는 이유를 모르지만 제안 된 솔루션은 그렇지 않습니다. –