简体   繁体   English

如何将 Next.js 连接到数据库?

[英]How to connect Next.js to Database?

I want to make an application "like" Samsung Health that will use massively queries on a Database.我想制作一个“像”三星健康的应用程序,它将在数据库上使用大量查询。

I would like to know if is better create a custom server made in Node.js (using Express.js) rather than use the integrated one in Next.我想知道是否更好地创建在 Node.js(使用 Express.js)中制作的自定义服务器,而不是使用 Next 中的集成服务器。 On Next documentation seems to be some differences. On Next 文档似乎有些不同。

Where I can find other documentation?我在哪里可以找到其他文档? On Next documentation I didn't find anything that tell me how to proceed.在 Next 文档中,我没有找到任何告诉我如何继续的信息。

I solve it.我解决它。 I had to use fetch function and pay attention with the promise.我不得不使用 fetch function 并注意 promise。 I had to take the body of the post request and tranform it into json file.我不得不获取发布请求的正文并将其转换为 json 文件。 Obviously it's necessary that both backend and frontend are currently running.显然,后端和前端当前都在运行是必要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM