关于在 Sinatra 上使用express.js 而不是 Ruby 的想法吗?

发布于 2024-11-29 00:02:36 字数 160 浏览 0 评论 0 原文

我正在开发一款社交应用程序,并考虑使用express.js/nodejs,而不是我最初的选择 Sinatra/Ruby。

我最担心的是 Ruby 中可用的开源项目数量,以帮助快速完成工作。第二个主要问题是express.js 的稳定性/成熟度和完整性。

欢迎任何反馈、评论。

I'm working on a social app and considering using express.js/nodejs instead of my original choice, Sinatra/Ruby.

I'm mostly worried about the # of open source projects available in Ruby to help get things done quickly. The second major concern is the stability/maturity and completeness of express.js.

Any feedback, comments are welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢好甜 2024-12-06 00:02:36

希望这个答案能帮到你。这个周末我尝试做类似的事情。作为 Rails 的长期支持者(在熟练掌握 Rails 3.2.1 之后,我决定在这个周末跳槽并切换到 Nodejs作为一名普通的 JavaScript 编码员,我认为这会很有趣并且具有挑战性,

所以我坐下来,启动 Textmate,开始一个简单的 Nodejs 项目,然后使用 Twitter Bootcamp 进行调整。并且应用程序正在启动看起来很神奇,

然后我开始添加数据库支持。我必须找到一个非阻塞的 Postgresql 驱动程序,但是我必须手动创建 SQL 查询。我对 ActiveRecord 很着迷?好吧,我使用的教程是针对 Express 的。好吧,Flatiron 看起来很有前途,但是我开始考虑。这Flatiron 用于数据管理的示例 他们称之为“足智多谋”?我发现了一个关于狼吃松鼠的数据管理示例? has 和属于许多 示例在哪里?如何告诉 Flatiron 我的 Notes 模型是多态的并且它属于 TripsExpenses

我确信它们就在那里,但我找不到。

但情况会变得更好。射击。我以为我讨厌迁移,直到我不得不启动 pgAdmin 和/或 Navicat 来手动创建我的数据库。然后我不得不手动创建表......哦糟糕。我搞乱了 pgAdmin 中的一个专栏。但它不让我改变它!所以我不得不重新启动整个表的创建。啊。伙计,我现在缺少生成器和 rake db:migrate!

然后我意识到我花了整个周末(好吧,我编码的时间很少),而我所要展示的只是一个很棒的静态 HTML 页面,但它没有功能。

重点是,如果你擅长 Rails,那么 Nodejs 将是一个重大转变。也许你喜欢这个?也许不是。

周末结束时,我意识到了一件事。我的新应用程序将非常注重 UI,并将来回发送 JSON 到后端服务器。 Rails 为此提供了一个出色的工具带。 Rails 非常乐意使用 JSON。事实上,我的应用程序将是通过 nginx 提供的静态 HTML 页面,Rails 将使用控制器驱动数据层。

如果你想从头开始开发过程的每一个部分,我的建议是学习 Express/Nodejs。如果您想构建自己的查询字符串。如果你想手动完成所有事情。也许你喜欢那样。也许您有让世界变得更轻松的想法。也许您想使用 Tower.js 或 Flatiron.js 或其他 Nodejs 框架。

或者,也许你像我一样,有一个该死的应用程序想要完成。然后使用Rails。

Hopefully this answer will help you out. I tried to do something similar this weekend. Being a long-time supporter of Rails (and after becoming pretty good at Rails 3.2.1, I decided to jump ship this weekend and switch to Nodejs. Being an average JavaScript coder, I thought this would be fun and challenging.

I even bought a Nodejs screencast from Peepcode. So, I sit down, fire up Textmate, get a simple nodejs project going, then tweak around with Twitter Bootcamp and the app is starting to look amazing, IMHO.

Then, I get to adding database support. Then BAM. Things hit me fast. I have to find a non-blocking Postgresql driver. Fine. Found one. What? I have to manually create SQL queries? But I'm so spoiled to ActiveRecord? OK, there appears to be AR type frameworks for node. But the tutorial I was using was for Express. But wait, Nodejitsu recommended Flatiron. OK, Flatiron looks promising. But wait, I start looking at the example Flatiron uses for data management. They call it "Resourceful"? I found one example of data management about a wolf eating a squirrel? Where are the has and belongs to many examples? How do I tell Flatiron that my Notes model is polymorphic and it belongs to Trips and Expenses?

I'm sure they're out there, but I couldn't find it.

But it gets better. Shoot. I thought I hated migrations until I had to fire up pgAdmin and/or Navicat to manually create my databases. Then I had to manually create tables...oh crap. I messed up a column in pgAdmin. But it wouldn't let me change it! So I had to restart the entire table creation again. Ugh. Man, I am missing generators and rake db:migrate at this point!

Then I realized that I spent the whole weekend (well, what little time I have for coding) and all I have to show for it is an awesome static HTML page that is non-functional.

Point is, if you are good at Rails, then Nodejs is going to be a major shift. Maybe you like this? Maybe not.

At the end of the weekend, I realized something. My new app is going to be heavy on UI and is going to be sending JSON back/forth to the backend server. Rails provides an excellent toolbelt for doing this. Rails is perfectly happy speaking JSON. In fact, my app is going to be static HTML pages served via nginx and Rails will drive the data layer with controllers.

My suggestion is learn Express/Nodejs if you want to start from scratch on every piece of the development process. If you want to build your own query strings. If you want do everything manually. Maybe you like that. Maybe you have ideas on making it easier for the world. Maybe you want to use Tower.js or Flatiron.js or some other Nodejs framework.

Or, maybe you are like me and you have a damn app you want to finish. Then use Rails.

池木 2024-12-06 00:02:36

已经有几个与此主题相关的(类似)问题:

我最担心的是可用的开源项目的数量
Ruby 可帮助快速完成工作。

这是因为 Ruby 比 Node.js 要古老得多。我认为比库的数量更重要的是它们中有多少是用非阻塞风格构建的。如果您要比较 Ruby 和 Node.js,那么后者的大多数模块都是使用这种风格原生构建的,因为它是 Node.js 的本质。

第二个主要问题是稳定性/成熟度和完整性
Express.js。

尽管与 RoR 或 Sinatra 相比,express 相对年轻,但已经有几个应用程序成功构建在其之上的快递。

There are already several (similar) questions regarding this topic:

I'm mostly worried about the # of open source projects available in
Ruby to help get things done quickly.

This is due to the fact that Ruby is much older than node.js. I think that more important than # of libraries is how much of them are built with non-blocking style. In case you are comparing Ruby and node.js then most of the modules in latter are built natively with this style since it's a nature of node.js.

The second major concern is the stability/maturity and completeness of
express.js.

Although express is relativaly young compared to RoR or Sinatra, there are already several applications which were successfuly built on top of express.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文