Friday, 7 April 2017

My life is a lie...

I have been mostly a LAMP developer for the past few years, and despite the huge community and great opensource projects, I always feel kind of tired of developing with PHP.Hard to keep my projects consistent, clean, easy to maintain and motivated to work with. Lots of shared code, tons of frameworks, but its like nobody speaks the same language and everybody is doing things their own way.Laravel brought a lot of people together, but still....Today watching a video about Node, and it was BEAUTIFL... I feel like my life has been a mistake, a lie, and that NodeJS is the light of the truth. Oh God, forgive me but I feel like I want to worship Javascript and become a God myself with NodeJS as my base of creation.I'm in love!!Now... my dear people, give me some more light, and let my eyes see the way to the infinite of possibilities with NodeJS.As a mostly backend developer with php and limited front end using Javascript and JQuery, I want to know if there's any Node tutorials best suited for coders with php background, and not used to advanced javascript.Namaste!!

Submitted April 08, 2017 at 03:18AM by estupor

Trying to filter Twitter JSON object by keys always returns undefined error eventually

I'm using the 'twitter' npm package. I can receive some of what I want but it eventually returns an undefined error without fail. Is anyone experienced with the streaming API?

Submitted April 07, 2017 at 11:52PM by Chigurhshairdresser

Building & Deploying a Ghost Blog with Nanobox

http://ift.tt/2pbD0iz

Submitted April 07, 2017 at 11:24PM by scott_dsgn

Why is my wildcard route firing even after the res is sent at the correct route above it?

A simplified version of my app and issue:const express = require('express') const app = express() const router = express.Router() app.use(router) router.get('/', function (req, res) { res.send('Hello!') }) router.get('/*', async function (req, res) { console.log("NO!!") }) If I go to http://localhost:7000 I get BOTH 'Hello' in the browser - indicating that the request has been routed and handled by my first route... but then I ALSO get 'NO!' in the log - indicating that multiple routes are responding to the same request. This is surprising, and not preferred behavior.

Submitted April 07, 2017 at 07:36PM by L000

How is NodeJS async function calls different from native threads implemented using C++ (say using Qt5)?

I was wondering how would the performance vary for an event-driven application in following two implementations:Using Node, where events are handled by callbacks, and the language is built with concurrency in mind from ground-up.Making a GUI application using Qt5, where callbacks are connected using signal and slot mechanism. This is more tedious than the previous one but is widely used. I might use a thread pool of workers and a queue of tasks.How and why would the performance vary in either?

Submitted April 07, 2017 at 06:04PM by himanshub16

ELI5 - when is concurrency/asynchronousity awesome?

I'm relatively new to node, and finding out a lot about when concurrency/asynchronously is not awesome.One thing plaguing me is the multiple asynchronous database calls. If they are related, I want them all to work, or none at all. But as they all go at once, or else are chained together in Promise.all, or a try block, or a christmas tree of .then() statements, or awaiting on each other they are still independent, and that's a real problem for me, a partial success in terms of only a few out of multiple calls being successful is an issue in terms of ruining the dependent data, and none of these strategies seem to handle a rollback.But I know there is awesomeness. Where is the awesomeness? How does it work, and when does it come into play?

Submitted April 07, 2017 at 03:00PM by coderbee

express error handling

Hi, i'm new in node and express.I have a route handler that may call different functions depending on some request parameters, and I would like to know what's the best way to deal with errors inside the functions in order to pass errors to the error handling middleware.Consider something like this:router.get('/error/:error_id', (req, res, next) => { my_function(); } function my_function(){ // do something async, like readfile var f = fs.readFile("blablabla", function (err, data) { // would want to deal with the error }); } If an error occurs during fs.readFile, how do I pass the error to next to forward it to the error middleware?In case the function didn't call any async I/O operation, a simple try/catch in the route handler would be ok (i suppose), like this:router.get('/error/:error_id', (req, res, next) => { try{ my_function(); } catch(e){ next(e); }; } function my_function(){ // do stuff var f = fs.readFileSync("blablabla"); // possibly throws an error } Cheers

Submitted April 07, 2017 at 02:29PM by honestserpent