私はチュートリアルに従っていますが、このエラーを理解することはできません。ダブルチェックしたので、初心者が再び攻撃していることは間違いありません...
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:138:10)
at Object.runInThisContext (vm.js:199:10)
at Module._compile (module.js:624:28)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
[nodemon] app crashed - waiting for file changes before starting.
..
module.exports = function() {
this.getNoticias(connection, callback){
connection.query('SELECT * FROM noticias', callback);
}
return this;
}
関数の宣言に使用した式が無効です。
関数を宣言するには、次を使用する必要があります this.getNoticias = function(...)
したがって、完全なコードは次のようになります。
this.getNoticias = function(connection, callback){
connection.query('select * from noticias', callback);
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加