Advice Needed: How to properly connect React to MongoDB

后端 未结 1 2037
-上瘾入骨i
-上瘾入骨i 2020-12-16 21:36

I have been investing some time learning React, MongoDB, and other JS web app related tools. For a small project that I created, I am using this repository to create my toy

相关标签:
1条回答
  • 2020-12-16 21:51

    You have to create endpoint (server side) can be Node can be something else like php, and there you will accept request and insert the data to your database. Your React app will make ajax call to the server and the server will put the data to the database

    If you want to do that with express you can create simple express app with one route that will get the data from the client and will send that to MongoDB. you dont have to use Mongoose you can use MongoDB driver or outer to simply send the data to MongoDB.

    0 讨论(0)
提交回复
热议问题