造型关系等斜坡上升的提示

造型关系等斜坡上升的提示

本文介绍了开始使用Node.js的,angular.js和MongoDB,造型关系等斜坡上升的提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Java和关系世界来,并试图让我的脚湿。该应用程序我的工作是如何使用Node.js和蒙戈的后端和客户端是angular.js预约调度系统。

I am coming from Java and relational world and trying to get my feet wet. The app i am working on is an appointment scheduling system using node.js and MOngo on backend and client is in angular.js.

我想了解几个这可能是我的Java偏见的残余关键概念。在指向相关片段的任何帮助,教程是AP preciated。

I am trying to understand couple of key concepts which might be remnants of my Java bias. any help in pointing to relevant snippets, tutorials is appreciated.

1)我将如何管理蒙戈/节点预约,客户和服务重新presentative之间的关系?不要存储在任命得到创建的对象任命和用户ID的参考?难道用户需要有约会列表参考?

1) How would i manage relationships between appointment, customer and service representative in Mongo/Node? Do the appointment objects get created and a reference of user id stored in appointment? Does user need to have a reference to list of appointments?

2)用户authn / AuthZ的,因为节点被用作RESTful服务提供商如何创建基于角色的控制?例如,当用户作为服务代表,他应该得到批准签约。是否有一个模块,可以帮助?

2) User authn/authz, since node is being used as restful service provider how do i create role based control? For example when a user signs up as a service rep he should be approved. Is there a module which can help?

3)任何通用的模块,这给用户的注册等等?

3) Any generic module which gives reports on user signups etc?

4)如何管理的人在客户端MVC的权限?

4) How do people manage permissions on client side MVC?

任何指针是极大的AP preciated。

Any pointers are greatly appreciated.

推荐答案

这样做,你有一个服务器端组件,如,以及一个客户端组件使得然后只是有一个服务器 - 事情有点复杂的应用程序端框架。

Doing apps where you have both a server-side component, as-well as a client-side component makes things a little more complicated then just having a server-side framework.


  • 在使用像AngularJS一个客户端框架,所有的模板编译客户端,而不是服务器端。这是从传统的服务器端呈现的巨大差异。这意味着,而不是发送HTML呈现给客户,你会送JSON。您的服务器将基本上成为安全架设一个RESTful API。

  • When using a client-side framework like AngularJS, all your templates are compiled client-side, not server-side. That's a huge difference from traditional server-side rendering. That means, instead of sending rendered HTML to the client, you would send JSON. Your server would essentially become a RESTful API with security emplacements.

我不是非常熟悉AngularJS,更与Ember,但你会基本上是创建一个RESTful服务:。这将有一个RESTful接口上的服务器进行通信。

I'm not extremely familiar with AngularJS, more with Ember, but you would essentially create a restful service: https://gist.github.com/2432692 . That would communicate with the server on a RESTful interface.

在服务器上,使用的NodeJS,你会使用像猫鼬或类似的ORM。您可以创建关系,文件等...一个音符,你必须复制你的模式上都,服务器和客户端。

On the server, using nodejs, you would use an ORM like Mongoose or something similar. You can create relationships, documents, etc... One note, you'll have to duplicate your models on both, the server and client.

MongoDB使用BSON,序列化的JSON字符串/对象的二进制编码。由于是的NodeJS使用V8 JavaScript引擎构建,JSON是一种天然的对象类型,并因此与MongoDB的工作是非常简单的。

MongoDB uses bson, a binary encoding of a serialized JSON string/object. Because nodejs is built using V8 JavaScript engine, JSON is a natural object type and so working with MongoDB is extremely simple.

在HTTP服务器的NodeJS:提供的NodeJS对于HTTP服务器基本实现。这不是很多,但可以响应并处理请求。有没有会话,饼干,权威性的支持,所以您可以使用连接这基础上顶传统的HTTP服务器,或使用防爆pressJS它建立在两个连接和正常 HTTP 节点提供了服务器。防爆pressJS是非常容易上手,并REST风格的后端效果很好。

HTTP Server on NodeJS: NodeJS provides a base implementation for an http server. It's not much, but you can respond to and handle requests. There are no session, cookie, auth support, so you can either use connect which builds on-top of the traditional http server or use ExpressJS which builds on both connect and the normal http server that node provides. ExpressJS is extremely easy to get started on, and works well with RESTful backends.

这是pretty简单。获得前pressJS,创建一个新的应用程序,设置所有客户端的东西(angularJS)和模块的系统如果使用AMD,CommonJS的,Browserify,等等...

It's pretty simple. Get ExpressJS, create a new app, setup all the client-side stuff (angularJS) and module systems if you use AMD, CommonJS, Browserify, etc...

这篇关于开始使用Node.js的,angular.js和MongoDB,造型关系等斜坡上升的提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:39