Hacker News new | ask | show | jobs
by KaterKarlo56 3835 days ago
Honest question: Why would someone use Node instead of a Rust web framework when writing part of the code in Rust anyway?
3 comments

- Node has full garbage collection. Rust has some very clever memory-handling, but it's not quite the same.

- Node is javascript. You may want to run the same code on client and server, and it's simpler than compiling Rust to JS.

- There may be JS libraries you want to use.

I could go on.

> Node is javascript. You may want to run the same code on client and server, and it's simpler than compiling Rust to JS.

What would be the reason to do that?

You need to do the same thing on the client and the server.

- DOM manipulation for AJAX states so they can be reached directly from the server without needing client side JS to do anything

- Calculate discounts for products (obviously clients just POST the product they want, but the discounts should be applied on the server consistently to how they were shown to the user)

- Your code is something generic, like recursively checking for a keypath on an object, and totally useful for JS anywhere it runs.

All kinds of other reasons.

I found it rather pleasant to have the same libs on client and server. Learn one lib API and use it everywhere :)

It also enabled me to move functionality freely around.

Calculating report data on the front-end, so it gets ready tomorrow and later moving it into the back-end, for performance reasons.

The reason that I'm using Rust and Node together is Lambda. It supports Java, Python and Node and my (admittedly perfunctory) tests showed that Node had the smallest overhead of the three in getting to Rust. However, this library seems to offer a richer interaction between the two platforms, which would imply using Node as something beyond a bridge to Rust, so there's likely an answer beyond mine that the author has in mind.
Because rust isn't web yet: http://arewewebyet.com.
That site is very out of date. We've been trying to get it fixed (as none of us control it), but we haven't been able to so far. :(
To clarify, are you saying that Rust is web (i.e. that the tools necessary for modern web server development and deployment are available to the Rust ecosystem)?
Depends on what your needs are. I think Rust is ready for certain Web apps. crates.io runs on Rust, for example, and it's a modern Ember-based web app running right now.

I think that the situation is a lot better than that site indicates.