News for hackers. Stuff that matters.
Re:Hapi, new Node.js framework (a prologue) by javajosh on Sunday February 03, 2013 @12:53AM (#5158818)
This certainly looks like the best "traditional style" webapp framework yet for node - e.g. something that reminds me strongly of a well-apportioned SpringMVC setup.

That said, I'm a huge fan of Meteor. It is (almost) totally non-traditional, but granted it does not give you the fine-grained control of this framework. I can see Hapi being the correct choice if either a) your developers are uncomfortable with large paradigm shifts (and seriously, who can blame them?) or b) you have to conform to a pre-existing API that requires low-level control (which is, of course, a total bummer).

Very nice work - and from my skimming of your docs, very nice documentation. Lots of good info in there without a lot of fluff, and I like that it's all on one page. Kudos. I'll definitely try Hapi instead of Connect next time I need something like this.

Re:Hapi, new Node.js framework (a prologue) by peter_l_downs on Saturday February 02, 2013 @09:31PM (#5158303)
This looks fantastic. The link to the framework itself is https://github.com/walmartlabs/hapi.

In particular, I'm excited about the way endpoints are registered:

  // Define the route
  var hello = {
      handler: function (request) {

          request.reply({ greeting: 'hello world' });
      }
  };

  // Add the route
  server.addRoute({
      method: 'GET',
      path: '/hello',
      config: hello
  });
This makes it extremely easy to expose API endpoints to internal modules. Let's say your company has a module related to simple math operations -- exposing this externally is as simple as adding a 'handler' method.

  var SimpleMath = new function() {
    var module = this;
    module.divide = function(a, b) {
      return a  / b;
    };
    module.multiply = function(a, b) {
      return a * b;
    };
    
    // Now add the external handler.
    module.handler = function(request) {
      // somehow access two variables, a and b
      request.reply({
        product: module.multiply(a, b);
        quotient: module.divide(a, b);
      });
  }
Re:Hapi, new Node.js framework (a prologue) by javajosh on Sunday February 03, 2013 @12:49AM (#5158805)
Doing this would be a mistake. You do not want to add web-aware code to a module that is concerned with doing math.
Re:Hapi, new Node.js framework (a prologue) by adamnemecek on Sunday February 03, 2013 @04:13AM (#5159167)
I believe that peter_l_downs was using this exotic literary device called an "example". When you read about class inheritance, was your first reaction "This is useless, why would I ever want to have a Dog class which is based on an Animal class"?
Re:Hapi, new Node.js framework (a prologue) by randallsquared on Sunday February 03, 2013 @09:51AM (#5159807)
Having an internal module know how to interact with a request seems to me to be the point of the example, and I also disagree with it, as a rule.
Re:Hapi, new Node.js framework (a prologue) by flaviojuvenal on Sunday February 03, 2013 @10:30AM (#5159900)
The module doesn't know how to interact with a request. Only with integer variables.
Re:Hapi, new Node.js framework (a prologue) by account_taken on Sunday February 03, 2013 @05:31PM (#5161491)
// Add the route server.addRoute({ method: 'GET', path: '/hello', config: hello });

I'm sorry but how is that different than

    app.get('/hello', require('simplemath'));
where simplemath is

    module.exports = function(req, res) { ... }
Re:Hapi, new Node.js framework (a prologue) by account_taken on Sunday February 03, 2013 @05:34PM (#5161505)
nm. I didn't see the example was returning two properties. Still, that is relatively easy to do. I have a middleware that does that and it's very short not yet another framework.
Re:Hapi, new Node.js framework (a prologue) by benatkin on Sunday February 03, 2013 @03:33AM (#5159094)
> We also looked at Restify, Tako, and a few others.

With the long list of things checked out, I doubt they gave the "few others" a close look. Which is too bad, because Geddy may have been just the ticket.

Re:Hapi, new Node.js framework (a prologue) by tbrock on Sunday February 03, 2013 @11:47AM (#5160123)
While I know multitudes of new frameworks are usually unwelcome wheel reinventions, this seems very well done. Kudos to the team.

Releasing software like this makes me wonder what other kind of amazing things are going on at Walmart Labs. They have an incredible amount of data about shopping behavior.

Re:Hapi, new Node.js framework (a prologue) by joelcox on Sunday February 03, 2013 @12:32PM (#5160302)
One of the guys who is working on this is Eran Hammer, who also co-authored several OAuth specs. He's working on OAuth alternative called Oz (https://github.com/hueniverse/oz).
Re:Hapi, new Node.js framework (a prologue) by c4urself on Sunday February 03, 2013 @12:12AM (#5158726)
Wow this looks really nice -- great work! Like the built-in monitor functionality.
Re:Hapi, new Node.js framework (a prologue) by anthem001 on Sunday February 03, 2013 @12:27PM (#5160278)
Played with it a bit last night. Initial impression is it has a much lighter feeling than other frameworks I've tried. Will be diving in deeper for sure.

Thanks for releasing this guys!

Re:Hapi, new Node.js framework (a prologue) by nateweiss on Sunday February 03, 2013 @01:52PM (#5160628)
Looks very helpful. Batch mode in particular is a great feature. Thank you.
Re:Hapi, new Node.js framework (a prologue) by dgem on Wednesday February 06, 2013 @11:37AM (#5177306)
any comments on how it compares with say Restify (http://mcavage.github.com/node-restify/) from folks who have used both ?
Re:Hapi, new Node.js framework (a prologue) by franze on Sunday February 03, 2013 @04:54AM (#5159238)
will definitely try thi over express for my next weekend project, an example in the doc on how to plug in socket.io into hapi would be nice.