如何从Twilio函数中连接到SQL Server数据库

发布于 2025-02-05 02:32:46 字数 112 浏览 0 评论 0原文

当我的Twilio号码发出短信时,我希望关联的功能查询我的SQL Server数据库,以确定我是否具有与此数字关联的名称。

我可以从node.js代码中连接我的twilio函数写在外部数据库中吗?

When a text message comes in to my Twilio number, I would like the associated function to query my SQL Server database to be able to determine if I have a name associated with this number.

Can I connect from within the node.js code that my Twilio function is written in to an external database?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慕烟庭风 2025-02-12 02:32:47

您可以从Twilio函数中连接到SQL数据库。我建议您阅读此博客文章,这是连接到连接到来自Twilio函数的MySQL数据库。在博客文章中,代码使用mySQL节点软件包连接到数据库并发送SQL命令。对于SQL Server,您可以使用 node-mssql package。您也可以使用ORM来更容易提出请求。

博客文章确实使用了旧版本的函数,我建议使用功能服务,但是其他所有内容都应按照所述工作。

You can connect to a SQL database from within a Twilio Function. I recommend you read this blog post, which is a good example of connecting to a MySQL database from a Twilio Function. In the blog post, the code uses the mysql Node package to connect to a database and send SQL commands. For SQL Server you can use the node-mssql package. You could also use an ORM to make it easier to make requests.

The blog post does use the older version of Functions, I recommend Function Services, but everything else should work as described.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文