可以angularjs直接连接到MongoDB的? [英] Can angularjs connect directly to mongodb?

查看:324
本文介绍了可以angularjs直接连接到MongoDB的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来angularjs和标题所说,我想知道是否有直接连接angularjs不使用前press.js编码额外的服务器端MongoDB的一种方式。我试图在互联网上搜索,但我无法找到任何资源。

I am new to angularjs and as the title said, I am wondering if there is a way to connect angularjs directly to mongodb without coding additional server side using express.js. i tried to search on the Internet but i cannot find any resources.

推荐答案

对不起你正在尝试在不可能的事。您将需要引进一些服务器端技术,这样就可以聊到数据库,并形成某种API的,将根据一定的业务规则coded到你的应用程序的后端返回JSON数据。 AngularJS有内置的模板接收JSON数据并把它作为你直接到整个DOM。

Sorry what you are trying to do in not possible. You will need to introduce some serverside technologies so that you can talk to the database and form some sort of api that will return JSON data depending on certain business rules coded into the backend of your application. AngularJS has templating built into it which receives JSON data and places it as you direct it to throughout the DOM.

你问的是什么逻辑,我以前不知道这个问题,以及来自世界前端未来。如果该无服务器侧code其中曾经发生的,该数据库查询将被暴露在客户端的用户。然后,客户机可以修改AngularJS查询语法中的code检查。 BAM ......现在一切都在你的数据库中的数据的,现在暴露给用户。以往更糟,这可能意味着用户可以执行删除OPS和诸如此类的东西。反正我希望这揭示了一点光对你的主题!在这里,两种资源,帮助我在这个服务器/客户端的东西:

What your asking is logical, I used to wonder this as well coming from the frontend world. If this no-server side code where ever to happen, the database queries would be exposed to the user on the client side. The client could then modify the AngularJS "query syntax" in the code inspector. BAM... now all of the data held in your database is now exposed to the user. Ever worse this could mean that the user could perform delete ops and whatnot. Anyways I hope this sheds a bit of light on the subject for you! Here two resources that helped me on this server/client stuff:

http://tomdale.net/2015/02/youre-missing-the-point-of-server-side-rendered-javascript-apps/

<一个href=\"https://medium.com/google-developers/tradeoffs-in-server-side-and-client-side-rendering-14dad8d4ff8b\" rel=\"nofollow\">https://medium.com/google-developers/tradeoffs-in-server-side-and-client-side-rendering-14dad8d4ff8b

这篇关于可以angularjs直接连接到MongoDB的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆