2015. március 17., kedd

10 weeks of node.js after 10 years of PHP

How I did things before on the server with PHP and the Laravel framework:


Route::get(‘user/id’, function($id) 
$user = User::find($id);
return Response::json($user->toArray());
);

And how I do the same thing now with node.js, Express and mongoose


app.route(‘/user/:id’).get(function(req, res) 
User.findById(req.params.id).exec(function(err, user)
res.jsonp(user);
);
);

Looking at this you might wonder what all the fuzz is about and why people get so emotional when talking about different programming languages.


source: https://medium.com/unexpected-token/10-weeks-of-node-js-after-10-years-of-php-a352042c0c11



10 weeks of node.js after 10 years of PHP