News for hackers. Stuff that matters.
Re:ExpressJS 4.0 has been released by zzzaim on Friday April 11, 2014 @08:57AM (#7572570)
And here are the new features in Express 4.x: https://github.com/visionmedia/express/wiki/New-features-in-...
Re:ExpressJS 4.0 has been released by nailer on Friday April 11, 2014 @09:29AM (#7572696)
I love you Express, but my next project is going to be based on TJ's own Express successor: http://koajs.com/
Re:ExpressJS 4.0 has been released by romanovcode on Friday April 11, 2014 @11:14AM (#7573333)
Don't forget to switch when next framework arrives. You don't want to be one of those unpopular geek losers, right?
Re:ExpressJS 4.0 has been released by LunaSea on Friday April 11, 2014 @11:42AM (#7573542)
Yeah you'd rather want to be the aggressive inpertinent kind.
Re:ExpressJS 4.0 has been released by jaegerpicker on Friday April 11, 2014 @12:46PM (#7573977)
Yes because we should never switch to something we think is better right? I mean advances who needs or wants that?
Re:ExpressJS 4.0 has been released by ulisesrmzroche on Friday April 11, 2014 @01:03PM (#7574097)
No, but so far I've been using koa, it's really worth making the switch.
Re:ExpressJS 4.0 has been released by prezjordan on Friday April 11, 2014 @12:03PM (#7573697)
Koa, if anything, will actually replace connect[1], which is the middleware layer that express is built on top of.

And yes, TJ built that too.

[1]: https://github.com/senchalabs/connect

EDIT: Looks like Express doesn't use Connect anymore. I'm out of the loop.

Re:ExpressJS 4.0 has been released by ulisesrmzroche on Friday April 11, 2014 @03:02PM (#7574781)
Yeah, also, Koa has a lot of express sugar baked-in, express turned into sugar on top of connect, then left connect behind and so on that koa is actually really removed from connect.
Re:ExpressJS 4.0 has been released by alessioalex on Friday April 11, 2014 @10:26AM (#7573005)
That's not a successor, it's a different framework based on generators. It's not as if it was Express 5.x or something.
Re:ExpressJS 4.0 has been released by benesch on Friday April 11, 2014 @10:42AM (#7573114)
From the Koa homepage:

> Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation

I think he meant successor in the spiritual sense, which is undeniably true.

Re:ExpressJS 4.0 has been released by ulisesrmzroche on Friday April 11, 2014 @10:50AM (#7573156)
It's going to be an even bigger hit than express, for sure.
Re:ExpressJS 4.0 has been released by nailer on Friday April 11, 2014 @11:21AM (#7573383)
I've been playing with 'Co', the thunk / flow control framework TJ uses for Koa:

    #!/usr/bin/env node --harmony
    var fs = require('fs'),
      co = require('co'),
      thunkify = require('thunkify'),
      request = require('request'),
      readFile = thunkify(fs.readFile);
      get = thunkify(request.get);

    var log = console.log.bind(console);

    // Create a thunk, and run it immediately.
    co(function *(){
      try {
        var fileContents = yield readFile('myfile', 'utf8');
        log(fileContents);
        var yahoo = (yield get('http://yahoo.com'))[0];
        log(yahoo.statusCode)
      } catch(error) {
        log('Oh no, an error!')
        log(error.code)
      }
    })()
Async, inline, catching errors. It's nice.
Re:ExpressJS 4.0 has been released by ulisesrmzroche on Friday April 11, 2014 @02:22PM (#7574539)
Yeah, once you start using yield it's really hard to write JS without it. It's nice to get that keyword back.

You can start throwing that on mocha too, it's pretty sweet.

Re:ExpressJS 4.0 has been released by btd on Friday April 11, 2014 @02:19PM (#7574525)
It is nightmare for v8 jit.
Re:ExpressJS 4.0 has been released by andreypopp on Friday April 11, 2014 @03:13PM (#7574861)
Who needs JIT on I/O bound tasks?
Re:ExpressJS 4.0 has been released by coldtea on Friday April 11, 2014 @03:17PM (#7574891)
Any links for that?
Re:ExpressJS 4.0 has been released by btd on Friday April 11, 2014 @03:29PM (#7574996)
v8 does not optimize blocks inside try catch (not too fresh http://www.html5rocks.com/en/tutorials/speed/v8/) and about generators and optimizations (http://wingolog.org/archives/2013/06/11/ecmascript-generator...)
Re:ExpressJS 4.0 has been released by lttlrck on Friday April 11, 2014 @09:41PM (#7576583)
it's a nightmare for crankshaft.
Re:ExpressJS 4.0 has been released by btd on Saturday April 12, 2014 @04:08AM (#7577287)
Yes, you are right. I forgot how they call own optimizer. (i wanted to point that people do not repeat blindly that peace of code)
Re:ExpressJS 4.0 has been released by batuhanicoz on Friday April 11, 2014 @09:19AM (#7572648)
I have been looking/thinking for the best way to implement something like the new Router functionality for 3 days now.

This is very good news for me.

Also, how to migrate guide can be found here: https://github.com/visionmedia/express/wiki/Migrating%20from...

Re:ExpressJS 4.0 has been released by beck5 on Friday April 11, 2014 @08:50AM (#7572545)
Express has been at the core of everything we have done, a great little framework. Going forward though its worth keeping an eye on http://koajs.com, like express it is built by visionmedia/tj but uses the new generators that are starting to become available in node.
Re:ExpressJS 4.0 has been released by highwind on Friday April 11, 2014 @09:17AM (#7572638)
Using "this" to generate response might cause lot of confusion.
Re:ExpressJS 4.0 has been released by gagege on Friday April 11, 2014 @12:12PM (#7573749)
Thinking of "this" as simply the app's context helped me make sense of that.
Re:ExpressJS 4.0 has been released by philjackson on Friday April 11, 2014 @10:21AM (#7572970)
The latest commit message on (the now completely seperate) body-parser module is "asdf". Makes me nervous.
Re:ExpressJS 4.0 has been released by eogas on Friday April 11, 2014 @01:29PM (#7574243)
That was the FIRST commit to that repo. Not that it's great reasoning, but really how much info does 'Initial commit.' convey as opposed to 'asdf'?
Re:ExpressJS 4.0 has been released by philjackson on Friday April 11, 2014 @03:03PM (#7574787)
For a start it would have stopped me mistaking the first commit for the last commit. More importantly, where you see the commit message next to lines of code[1], "initial commit" hints that you can assume the line came with an import or boilerplate.

1. https://github.com/expressjs/body-parser/blame/master/index....

Re:ExpressJS 4.0 has been released by djjaxe on Friday April 11, 2014 @04:06PM (#7575247)
If you clicked on the 86446f74

You would have gotten: https://github.com/expressjs/body-parser/commit/86446f74d5c6...

Which shows parents 0

Re:ExpressJS 4.0 has been released by codygman on Friday April 11, 2014 @12:24PM (#7573830)
Bad commit messages are a big warning sign to me too.
Re:ExpressJS 4.0 has been released by gexla on Friday April 11, 2014 @02:03PM (#7574434)
Go take a look through TJ's Github credentials. I don't know who made that commit, but TJ has this well handled I'm sure.
Re:ExpressJS 4.0 has been released by mmcclure on Friday April 11, 2014 @07:29PM (#7576197)
I would argue that TJ's Github credentials don't necessarily make the best argument for his long term project. The guy is brilliant and prolific, but he admits to not being the best at long-term maintenance.

For instance, his response to the whole n rm -rf debacle: "yeah it's kinda tough when you have 250+ OSS projects, inevitably some get messed up over time and I merge broken shit haha". That being said, it looks like he's let other folks take over Express (who are all qualified). He didn't even know the logger was named "Morgan" until he read it in a blog post about Express 4.

Re:ExpressJS 4.0 has been released by jpdlla on Friday April 11, 2014 @10:40AM (#7573098)
If you're also wondering about what the changes were for 4.0 https://github.com/visionmedia/express/blob/master/History.m...
Re:ExpressJS 4.0 has been released by sgy on Friday April 11, 2014 @12:59PM (#7574064)
Most of the middlewares (like logger) are no longer bundled with Express and must be installed separately.

https://github.com/senchalabs/connect#middleware

Re:ExpressJS 4.0 has been released by sgy on Friday April 11, 2014 @01:33PM (#7574268)
Re:ExpressJS 4.0 has been released by ollysb on Friday April 11, 2014 @09:59AM (#7572848)
I had a play with express/node a whole back but found it quite low level (useful in some cases). Is there anything closer to rails in node or is there a preference for piecing everything together with libraries?
Re:ExpressJS 4.0 has been released by jahansafd on Friday April 11, 2014 @10:01AM (#7572859)
take a look into Sail.js, Meteor.js or the MEAN stack

http://sailsjs.org/#! https://www.meteor.com/ http://www.mean.io/#!/

Re:ExpressJS 4.0 has been released by iLoch on Friday April 11, 2014 @11:27AM (#7573436)
As Jahansafd said, Sails.js is probably the most popular right now. It's a full MVC framework built on top of Express. It's constantly being improved, there's commits nearly every day.
Re:ExpressJS 4.0 has been released by srgpqt on Friday April 11, 2014 @06:03PM (#7575870)
Re:ExpressJS 4.0 has been released by sehr on Friday April 11, 2014 @10:15AM (#7572940)
The node.js community seems very unixy, small modules pieced together is the name of the game.
Re:ExpressJS 4.0 has been released by fauria on Friday April 11, 2014 @08:59AM (#7572573)
Re:ExpressJS 4.0 has been released by Jacqued on Friday April 11, 2014 @09:09AM (#7572603)
The changes make express even cleaner than before. The new routing system, allowing handling different verbs with chained functions, is pretty slick.

Also, decoupling default middleware and putting them into their own modules seems like the way to go, and more 'node-y' than packing everything together.

I'll be glad to get rid of the connect warnings too !

Although there's koajs, it's nice to see express is still getting some love

Re:ExpressJS 4.0 has been released by rubiquity on Friday April 11, 2014 @10:00AM (#7572854)
Does anyone know where I can find discussion about the Express team's decision to completely detach from connect? I'm also curious about what type of middleware design they went with, or if they just reimplemented connect in their own way, which wouldn't surprise me due to the prevalence of Not Invented Here syndrome in the Node community.
Re:ExpressJS 4.0 has been released by xGrill on Friday April 11, 2014 @10:06AM (#7572892)
From the migrating guide: "This change was made to allow for these [connect] middleware to receive fixes, updates, and releases without impacting express release cycles and vice versa."
Re:ExpressJS 4.0 has been released by rubiquity on Friday April 11, 2014 @10:12AM (#7572919)
Couldn't they still achieve that by depending on connect, but not depending on those specific connect middlewares?
Re:ExpressJS 4.0 has been released by jongleberry on Friday April 11, 2014 @08:12PM (#7576314)
connect is basically just a `.use()` kernel, and express' router was just mounted on this kernal. now, express' kernel combines connect's `.use()` kernel as well as the router, simplifying the entire middleware system internally and removing the need to do `app.use(app.router)`.

i.e. you're no longer mounting the router on top of another kernel.

Re:ExpressJS 4.0 has been released by mcantelon on Friday April 11, 2014 @11:08AM (#7573286)
TJ's one of the original creators of Connect, so it's unlikely to simply be NIH.
Re:ExpressJS 4.0 has been released by jamescun on Friday April 11, 2014 @09:46AM (#7572761)
I love the new Router design, but I mainly use Restify[1] to build REST APIs for SPAs. How easy would it be to use port Express's new Router to Restify?

[1] https://github.com/mcavage/node-restify

Re:ExpressJS 4.0 has been released by pspeter3 on Friday April 11, 2014 @12:03PM (#7573700)
Why do you primarily use that as opposed to building in express?
Re:ExpressJS 4.0 has been released by modarts on Friday April 11, 2014 @04:10PM (#7575275)
Maybe i'm missing something, but restify seems to have an identical API to express
Re:ExpressJS 4.0 has been released by iamartnez on Friday April 11, 2014 @12:51PM (#7574013)
One thing express doesn't do is manage URLs for you. I wrote a simple module that does this[0]. It helps, especially when you have a large number of URLS.

[0] https://github.com/artnez/urltree

Re:ExpressJS 4.0 has been released by jdc0589 on Friday April 11, 2014 @10:17AM (#7572953)
Very cool. Interestingly enough, a lot of Express features are starting to align with Bogart (https://github.com/nrstott/bogart) features, and vice versa unintentionally.
Re:ExpressJS 4.0 has been released by ika on Friday April 11, 2014 @08:54AM (#7572562)
I really like this new http://expressjs.com/4x/api.html#router feature.

This will help me build better architecture for application on top of express

Re:ExpressJS 4.0 has been released by bricss on Saturday April 12, 2014 @07:14AM (#7577572)
Hapi.js to everyone http://spumko.github.io/
Re:ExpressJS 4.0 has been released by tegeek on Friday April 11, 2014 @11:51AM (#7573602)
Another complete web framework in NodeJS world.

http://www.partialjs.com/

Its a bit high level than Express but same performance wise. I like it becoz you get started in 2 minutes.

Re:ExpressJS 4.0 has been released by findjashua on Friday April 11, 2014 @03:42PM (#7575114)
Any particular reason to choose Express over Koa?
Re:ExpressJS 4.0 has been released by jongleberry on Friday April 11, 2014 @08:09PM (#7576300)
not really. use koa instead if you can. a lot of middleware hasn't been written for koa yet, so you might have to write your own.
Re:ExpressJS 4.0 has been released by kayoone on Friday April 11, 2014 @11:27AM (#7573432)
Partly unrelated but i have read strong evidence[1] suggesting that the ExpressJS author (TJ) does not even exist as a real person and is an entirely constructed online identity who is portrayed by different people. Not that it matters too much though, still interesting ;)

[1] http://www.quora.com/TJ-Holowaychuk-1/How-is-TJ-Holowaychuk-...

Re:ExpressJS 4.0 has been released by base698 on Friday April 11, 2014 @12:00PM (#7573677)
I met him once at a Node.JS bar/podcast talk about 2 years ago. He looks just like his Twitter picture. Could still be the figure head of a bunch of people I guess.
Re:ExpressJS 4.0 has been released by tsenkov on Friday April 11, 2014 @12:17PM (#7573784)
TJ is working for Segment.IO: https://segment.io/team
Re:ExpressJS 4.0 has been released by damon_c on Friday April 11, 2014 @12:42PM (#7573951)
So productive... never posts on Hacker News... Hmmm...
Re:ExpressJS 4.0 has been released by paulbaumgart on Friday April 11, 2014 @01:36PM (#7574286)
Is he also Satoshi Nakamoto?
Re:ExpressJS 4.0 has been released by camus2 on Friday April 11, 2014 @12:04PM (#7573702)
lol TJ is real and too smart for his own good;)
Re:ExpressJS 4.0 has been released by bright_day on Friday April 11, 2014 @08:59AM (#7572574)
finally i am really excited