DEV Community

Discussion on: Why we love and choose Ruby instead of Node.js?

Collapse
 
michi profile image
Michael Z • Edited

You are comparing a framework with a programming language (actually Node.js is not even that, it's a js runtime).

That being said there are some strong frameworks in the nodejs world itself. If you want something inspired by RoR/Laravel, go check out AdonisJs, it comes with many RoR concepts like active record, convention over configuration etc. Also has db migrations and everything. (I've written some articles about it)

There are some more higher level frameworks like Nestjs but haven't looked into it much.

Example of how a test looks like in AdonisJs:

test('resets password with correct token', async ({ assert, client }) => {
  const user = await Factory.model('App/Models/User').create()
  const token = await (new TokenService).generateToken(user.email)

  const response = await client.post('/password/reset').send({ email: user.email, token, password: 'new password' }).end()
  await user.reload()

  response.assertStatus(200)
  response.assertJSON({ message: 'Password reset successful.' })
  assert.isTrue(await user.verify('new password'))
})
Enter fullscreen mode Exit fullscreen mode
Collapse
 
simonoff profile image
Oleksandr Simonov

I don't like async/await at all. Its making code more hard to understand and debug.
In the case of Ruby mostly all web ecosystem working around Rails.