[英]I am trying to connect Angular to MongoDB
I have a simple Angular app and it is running in Local Host 4200. How do I save the form values and store them in a MongoDB database?我有一个简单的 Angular 应用程序,它在本地主机 4200 中运行。如何保存表单值并将它们存储在 MongoDB 数据库中?
Angular is a web framework dedicated for the client-side, MongoDB is a NoSQL database, to save your data put into your angular app to your Database, you need a server-side implementation like nodejs or python, java, etc.. Angular is a web framework dedicated for the client-side, MongoDB is a NoSQL database, to save your data put into your angular app to your Database, you need a server-side implementation like nodejs or python, java, etc..
I recommend for you to use expressjs as an API framework it can helps you to get started我建议您使用expressjs作为 API 框架,它可以帮助您入门
Angular is not supposed to connect directly to a DB in an real project, so there is not much of a point to practice doing so. Angular 不应该直接连接到实际项目中的数据库,因此练习这样做没有太大意义。 You should have an server-side application or a mock to do so.
您应该有一个服务器端应用程序或一个模拟来执行此操作。 If you are trying to build a front for studies you can use packages such as this one to begin: https://www.npmjs.com/package/auto-api
如果你想建立一个研究的前沿,你可以使用这样的包开始: https://www.npmjs.com/package/auto-api
It is of simple use and you can save data without configuring or installing a DB.它使用简单,无需配置或安装数据库即可保存数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.