
Adonis.js v2 released – Laravel for Node.js - niallobrien
http://adonisjs.com
======
TheAceOfHearts
This is sorta tangentially related...

I used to think DI was a good idea, but as I've gotten more experience... I'm
no longer convinced using a DI framework nets you huge wins relative to the
added complexity. My hypothesis is that good design can remove the need for a
DI framework in many cases, or at least that's been my experience so far.
Maybe I just haven't worked in an application that's big and complicated
enough to justify a DI framework.

Don't get me wrong, there's usually going to a few moving parts you'll wanna
inject, in order to make testing easier. But you can just... do it manually.

Perhaps I'm wrong about this, but I get the impression DI tends to encourage
people to obsess over unit testing and abuse mocks. While I certainly believe
that unit tests add a lot of value, there's definitely a point where they
start to add little to no value.

Anyway, with that being said... The framework looks very interesting. I love
looking through frameworks like these and seeing how people decide to tackle
certain problems.

Thank you for sharing!

~~~
lostcolony
Agree. Especially in a language like Javascript. For testing -

    
    
      var myLib;
      if(process.env.NODE_ENV === "test") {
        myLib = require("../test/my_test_lib")
      } else {
        myLib = require("./my_lib")
      }
    

or similar (you can obviously tighten this code up, too; I'm just being very
explicit). Tada, you're injecting your test stubs in place of the real library
when running in test.

For the actual production use that a DI framework gives you, you can do
similar, or manually set things up, or create a layer of indirection yourself,
that only applies where you need it (say an IIFE that has the logic to
determine which implementation to pull in, and return that function/module as
appropriate).

But this is, as you say, largely tangential.

~~~
TheAceOfHearts
There's also stuff like rewire [0], which lets you change required values
inside modules. Although every time I've tried it, I found it created more
problems than it was solving.

[0]
[https://www.npmjs.com/package/rewire](https://www.npmjs.com/package/rewire)

~~~
madeofpalk
Proxyquire -
[https://github.com/thlorenz/proxyquire](https://github.com/thlorenz/proxyquire)
\- is a nicer way to solve many of the problems that people tend to use rewire
for.

We use it to stub out imports in our unit tests and find it very easy.

------
WhitneyLand
Seems a bit confusing to use a single capital letter 'A' within a 6 sided
polygon as your logo, given that it's already been done by another popular JS
framework.

------
lf-non
Curious why the authors did not choose to use Babel+ES7 async/await instead of
generators.

The discussion in this ESDiscuss thread ([https://esdiscuss.org/topic/does-
async-await-solve-a-real-pr...](https://esdiscuss.org/topic/does-async-await-
solve-a-real-problem)) points to multiple advantages of embracing Async/Await
over generators for asynchronous code.

~~~
Joe8Bit
I can't speak for the author, but it may be for simplicity's sake.

Personally I would have still have gone Babel+* but a Babel transpilation
pipeline adds a non-negligible level of complexity to a project, especially
when it comes to debugging/performance optimisation.

------
taternuts
According to who/what? I've never heard of this framework, but a quick glance
at the source and I find it hard to believe it comes close to Laravel's
features. I guess it's the week to post about Node.js MVC frameworks with the
whole Sails/Trails thing

~~~
gremlinsinc
I'm not sure what you're looking at... but it does resemble laravel quite a
bit to me.. the way relations are setup is almost identical laravel: public
function resources(){ return $this->belongsToMany('App\Resource'); }

Adonis: posts () { return this.hasMany('App/Model/Post') }

The routes/middleware page seems even closer to laravel 5's, that's all I've
looked through so far, but it does look interesting at least as far as
frameworks go, though I'd wait a bit before putting anything into production
on it, till it gains some more momentum.

~~~
catshirt
i mean, these features resemble basically every MVC ever

~~~
Can_Not
So what exactly were you expecting? What that defines "Laravel" to you is
missing?

~~~
taternuts
years of iteration, really

------
romainlanz
Reddit thread.
[https://www.reddit.com/r/javascript/comments/3z1qmy/adonisjs...](https://www.reddit.com/r/javascript/comments/3z1qmy/adonisjs_v2_comes_out/)

------
Raed667
I've just found-out about this project and it looks very nice especially to
guy coming from Laravel/Symfony background.

A question for the JS experts: Between this and Trails(Sails) how does one
make a choice?

------
sotojuan
Interesting. This was also announced yesterday:

[https://github.com/trailsjs/trails](https://github.com/trailsjs/trails)

~~~
lf-non
It is interesting comparing the divergent chains of evolution:

Rails inspired ASP.net MVC inspired Laravel inspired Adonis

wrt.

Rails inspired Sails inspired Trails

Good to see the spirit of CoC and elegant pragmatism being carried forward.

------
timrpeterson
Laravel is a fantastic PHP framework, so if this is even close to as good for
JavaScript it is worth checking out.

~~~
RusAlex
Yes. Laravel is very coherent php framework. But it seems there is no need php
in future since ES6

~~~
yoonay
Yeah, once the full spec of ES6 is supported by all _browsers_, we will see
that overnight, all legacy PHP will disappear and everyone will stop
developing with PHP. The PHP runtimes magically transform themselves into
Node.js and all is well in the realm of web. Behold the day of the rapture.js.

------
Oras
Looks really interesting one. I had a quick look at docs and its well
structured and informative

------
marcus_holmes
nope. I'm done. There are enough JS frameworks, client and server side. I
don't need to look at another one.

I'd really like 2016 to be the year that everyone who thought of making
another new JS framework decided to not do that and instead go fix bugs in one
of the existing ones that people are already using.

~~~
dplgk
What do you like to use?

~~~
marcus_holmes
React+Redux and Express at the moment, but that's at the end of a long, long
trail of trying out JS frameworks.

I got fed up of constantly learning new frameworks searching for that One True
Framework that would be expressive and powerful but without too much
boilerplate and... well, you know the quest.

I gave up looking for the Holy Grail and settled on what seemed to be working
for me at that point (like quite a few other devs I know). It just got too
much, the constantly learning new apis in order to keep up.

hence "I'm done"... I'm going to go deep instead and really learn how to use a
single environment properly, as in 10,000 hours properly.

