Nodejs:在哪里或如何编写复杂的业务逻辑? [英] Nodejs: Where or How to write complicated business logic?

查看:437
本文介绍了Nodejs:在哪里或如何编写复杂的业务逻辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我了解了node.js以及像express和jade这样的酷包。我几乎没有问题一直敲门:

Recently I got introduced to node.js and cool packages like express and jade. I have few questions consistently knocking my door:

如果我选择node.js构建我的下一个网站,我将使用JavaScript编写我的服务器端复杂逻辑?但我不认为你可以将JavaScript与Java或Python进行比较来编写服务器端代码,因为它们拥有如此广阔的图书馆。 node.js真的意味着它吗?或者我错过了什么?

If I pick node.js to build my next website, I will be using JavaScript to write my server-side complicated logic? but I don't think you can compare JavaScript with Java or Python to write server-side code as they have such a vast ocean of libraries. Is node.js really meant for it? or I have missed something?

我可以从node.js调用Java或Python吗?

Can I call Java or Python from node.js?

推荐答案

不太确定大多数人在谈论什么。

Not quite sure what most of these folks are talking about.

社区正积极致力于广阔的图书馆海洋。检查一下: http://search.npmjs.org/#/_analytics - 发布了8个软件包昨天

A "vast ocean of libraries" is something the community is actively working on. Check this: http://search.npmjs.org/#/_analytics -- there were 8 packages published yesterday

它不会为您解决您的软件设计。至于在哪里以及如何编写业务逻辑,我们中的许多人都接受mvc或mvvm或接近它的东西。如果您正在构建一个应用程序并且像Rubyists(例如)那样构建他们的代码,那么您可能会考虑做一些类似的事情 - 没有人会告诉您如何构建代码。

Its not going to solve your software design for you. As for where and how to write business logic, many of us embrace mvc or mvvm or something close to it. If you're building an application and like how Rubyists (for example), structure their code you might look at doing something just like that -- aint nobody going to tell you how to structure your code.

检查 https://github.com/joyent/node/wiki/modules

一些比较流行的日常工作库:

Some of the more popular libraries for doing the day to day:


  • Express : http://expressjs.com/ - https:/ /github.com/visionmedia/express

    • Sinatra受到启发,用它来构建典型的网络应用程序

    • 统计数据: 3407名观察者,286名分叉,拉动请求 778

    • 将此与Sinatra本身进行比较! 2529观察者,366个叉子

    • 通过连接,它支持各种中间件:

      • 会话,

      • 各种路由,

      • 静态文件

      • 大约15种不同的模板引擎

      • 验证,表格处理等等

      • Express: http://expressjs.com/ - https://github.com/visionmedia/express
        • Sinatra inspired, use it to build a typical web app
        • Stats: 3407 watchers, 286 forks, on pull request 778
        • Compare that to Sinatra itself! 2529 watchers, 366 forks
        • With connect, it supports all kinds of middleware:
          • sessions,
          • all kinds of routing,
          • static files
          • some 15 different templating engines
          • validation, form handling, etc, etc
          • Variety of techniques for re-using your models on the server:
          • http://andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/
          • Techniques for re-using code on the server:
          • http://maccman.github.com/spine.tutorials/node.html

          • node_redis, https://github.com/mranney/node_redis - 或其他八个客户之一

            • 这是一个完整的节点Redis客户端。 JS。它支持所有Redis命令

            • node_redis, https://github.com/mranney/node_redis - or one of the eight other clients
              • "This is a complete Redis client for node.js. It supports all Redis commands"

              还有很多ORM,如果那是你的包。像 http://mongoosejs.com/ http://sequelizejs.com/ 和朋友

              There's also a host of ORMs out there, if thats your bag. Things like http://mongoosejs.com/, http://sequelizejs.com/ and friends

              测试驱动开发是节点的核心。有15种不同的TDD软件包可供选择,从完整代码覆盖分析到自定义断言模块。

              Test-driven development is at the core of node. There are 15 different TDD packages to choose from that range from full code coverage analysis to custom assert modules.

              说所有模块都不完整是愚蠢的。有一个令人难以置信的每天在这个社区中建立和维护吨开源的专门小组。

              Saying all modules are incomplete is silly. There is an incredibly dedicated group of people building and maintaining tons working open-source in this community every day.

              可能有理由通过节点,但不适用于非活动社区或缺乏图书馆。

              There might be reasons to pass over node, but its not for an inactive community or lack of libraries.

              这篇关于Nodejs:在哪里或如何编写复杂的业务逻辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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