连接Alexa和MySQL

时间:2019-12-02 16:52:57

标签: node.js alexa alexa-skill

我需要将Alexa连接到mysql数据库,但是我尝试了此错误:

There was an error with the Skill response you requested

这是我的代码,用于将Alexa连接到数据库:

var mysql = require('mysql');
var con = mysql.createConnection({
      host: "host",
      user: "user",
      password: "pass",
      port: 3306
    });
    con.connect(function(err) {
      if (err) throw err;
      speakOutput = 'Connected';
    });

这是我的package.json:

{
  "name": "hello-world",
  "version": "1.1.0",
  "description": "alexa utility for quickly building skills",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "Amazon Alexa",
  "license": "ISC",
  "dependencies": {
    "ask-sdk-core": "^2.6.0",
    "ask-sdk-model": "^1.18.0",
    "aws-sdk": "^2.326.0",
    "mysql": "^2.5.4",
    "ejs": "^3.0.1",
    "body-parser": "^1.19.0",
    "express": "^10.3.1"
  }
}

有什么建议吗?谢谢!

0 个答案:

没有答案