Saturday 30 April 2016

Red Hat ditches effort to port Node.js to Java

http://ift.tt/1N8EXaB

Submitted May 01, 2016 at 02:32AM by im-the-stig

Socket.io and Redis pub/sub

Hello everyone, me again.TL;DR (There's no long version of this question)I want to use socket.io.I need to run multiple instances on different ports. No problem here.I decided not to use Node's own cluster, I'll use Nginx for load balancing (that's why I create multiple instances of the app). It supports websockets, so this one is also sorted out.I want to use socketio, but there'll be multiple instances, so they can't talk to each other, so I need to use Redis' pub/sub mechanism as a wrapper in order to mimick socketio's emit & broadcast functionality. That way even if I have multiple instances of an app or run it on different servers, everybody will be able to talk to each other as long as they're connected to the same Redis server. To achieve this, I'll need socket.io-redis and socket.io-emitter modules.Have I got that right?

Submitted May 01, 2016 at 01:50AM by laraveling

Looking for one or two modules related to locking and update scheduling

Some people are going to think this is too trivial to look for modules or almost put it in a leftPad category perhaps, but there are so many things in npm I have a feeling these two requirements are covered and so am interested to see what other people have done.I inherited this codebase that has this sort of long updating function with a number of steps. It has sort of a custom locking flag that is half-set up to expire but doesn't actually have the expiration code. Anyway the main thing is to prevent the update from happening while something else is happening. Except sometimes we know we definitely need to update as soon as possible, but not right in the middle of a current update. This stuff is not actually quite working.So I am looking for one or two modules to do two things:a lock with an expiration that two different long-running functions (that call other functions with callbacks) can use to make sure they don't step on eachothera simple module/function that says 'do this function now, or run it again after it finishes its current run'.Or possibly something that handles both of those might actually make sense in this case, even though from my description it may not be obvious what they have to do with eachother.The expiration is if there is some case that I don't anticipate that causes the lock not to be removed, we don't want to be stuck forever.

Submitted May 01, 2016 at 12:54AM by runvnc

Node 6.0 export/import not working

Is there something I'm missing?

Submitted April 30, 2016 at 11:00PM by ASK_ME_ABOUT_FINIT

Everything You Ever Wanted To Know About Authentication in Node.js

https://www.youtube.com/watch?v=yvviEA1pOXw

Submitted April 30, 2016 at 09:33PM by jeppews

Node.js Twitter Bot.. Help needed

I want to make a Twitter bot that will retweet stuff based on hostages using Node.js. Don't know where to start. Any thoughts?

Submitted April 30, 2016 at 04:58PM by nodemonutil

An Image Uploading web application using Node.js and MongoDB... Any thoughts?

Hi, I have been trying my hands on MEAN Stack and currently focusing on Node.js and MongoDB and recently started to work on a web application similar to Imugr (social image sharing). I am using Express.js as framework for Node.js. What extra things I could work on just from uploading images and displaying them. Anything else you'd like to add that will help me in my learning process too?

Submitted April 30, 2016 at 04:41PM by nodemonutil

error-catch - My first basic NodeJS library. Simplify error catching. Please critique.

http://ift.tt/1rps9m6

Submitted April 30, 2016 at 03:01PM by ahtcx

My First Blog Post - Routes in External Files

So i recently decided that I wanted to start putting some blogs together around node and Javascript in general. This is my first one, talking about using external files for routes in express.Any constructive criticisms would be appreciated.http://ift.tt/1Nai1Yx

Submitted April 30, 2016 at 01:00PM by Tetrominos

Should NodeJs Have Interfaces Part 2

http://ift.tt/23goLpp

Submitted April 30, 2016 at 11:17AM by lee__mason

Friday 29 April 2016

Let’s Learn JavaScript Closures

http://ift.tt/24r7Rad

Submitted April 30, 2016 at 07:01AM by chintan9

Do I even need async?

I've been constructing an app in Node, which I am very new to. I need to iterate over a loop of templates, query a database of potential recipients, then send to each one. The functionality is completely solid, but I've been trying to asyncronize my functions via async and Promises for clean console logging, so I see things happen in order, and can quickly debug.Another strategy I've seen for this that may apply is simply using timed functions. I'm not sure if this is a good practice or not.I guess my question is am I on the right track with this async thing, or should I look for another route to tracking what's going on behind the scenes?

Submitted April 30, 2016 at 06:25AM by hypecraft

What to use for websocket server-to-server communication?

Socket.IO or is there a better solution?

Submitted April 29, 2016 at 11:35PM by maruchanr

(websockets) is there a faster way to send objects than calling JSON.stringify and JSON.parse?

I'm building something that's extensively depending on the ws package in nodejs for web sockets. I wrote a small method called emit which just takes an object you pass to it, calls JSON.stringify on the object to convert it to a string, then sends it to the client. The client retrieves the string and calls JSON.parse to convert it back to an object.The problem I'm facing is that I have to send thousands and thousands of packets, and I want my webpage to work decently well on my cell phone and other under powered machines, so I was wondering if there's a more efficient way of sending a js object/array other than hitting up stringify and parse for every message.

Submitted April 29, 2016 at 08:24PM by dont_forget_canada

Is there a login package(With encrypting etc)

Title! Would help a lot! _^

Submitted April 29, 2016 at 08:35PM by timgfx

How do I become a nodejs 10xer?

No text found

Submitted April 29, 2016 at 12:08PM by LAUAR

Are you a node.js developer and aspire to be a master in it? How to Become a Better Node.js Developer ?

http://ift.tt/1WWTFU7

Submitted April 29, 2016 at 12:13PM by Ema1225

Should NodeJs Have Interfaces?

http://ift.tt/1QEAN4L

Submitted April 29, 2016 at 10:21AM by lee__mason

Thursday 28 April 2016

Cluster, Nginx, Redis, websockets and Node : How to choose?

Hey!Here's what I am dealing with.-I'm using Express.js.-I'll setup Nginx to serve static files, pointing server IP to domain and setup SSL. That's a must.-I have to use pm2 (or equivalent) to keep my app alive, that's also a must.-I have a Redis instance that I use for messaging and user feeds.-Since I'm going to use pm2's cluster module, I need to be able to redirect the right stuff to the right direction when I'm dealing with socketio, so I'll use this (socketio + redis) : http://ift.tt/26zAQdH want to take advantage of my multi core server, so I need to be able to utilize all the CPU's I have. Both Nginx and pm2 offer this, planning to use pm2's, but do I also have to set Nginx's worker_processes stuff to number of CPU's I have OR does it uses the whole server automatically?Am I on the right track?If there's something you want to add or have any suggestions, please feel free to share.

Submitted April 29, 2016 at 07:35AM by laraveling

Stable release of fast, recursive file watcher for node

http://ift.tt/26zk7Hu

Submitted April 29, 2016 at 05:05AM by fireboat

My Node.js endpoint/hashing issue, on Stackoverflow

http://ift.tt/1Tzi7YG

Submitted April 29, 2016 at 12:29AM by Endertech74

In your database service calls, do you usually just return the db promised call, or do you prune the data there?

I have routes that calls upon database service functions that return promises.. And on the router layer, I chain the output of the function calls togethers, to construct the proper data response for the end-user. My question is that the mongo native driver, oftentimes has the actual data saved in something like dbResultd['ops'][0]['_id'] (upon insertion). Or on find, i'll need to do .limit().next(). Is this something i'd want to do in my service or route? It just seems like all a bit of a pain, because i'm not sure if the promise will catch things like a null return.Here's an explicit example of a service call:export const insertCommentForFileID = (userID, fileMetaID, comment) => { const date = new Date(); fileMetaID = convert.strToMongoID(fileMetaID); return db.sharedInstance().collection('comments').insertOne({ fileMetaID: fileMetaID, author: userID, comment: comment }); } The actual saved data that i may want to shoot back to the user is ingested in the promise as: ['ops'][0]['_id']I can append .then((r) => return r['ops'][0]['_id']) to the service but this just seems like a lot of boilerplate for each db access call

Submitted April 28, 2016 at 11:59PM by awhoof

Hapijs and ionic framework

http://ift.tt/1qYMHkO

Submitted April 28, 2016 at 07:29PM by indatawetrust

Superchild is a POSIX-only (e.g., Linux, Mac OS X) wrapper around node.js's built-in child_process module, which requires a lot of care and attention to use correctly.

http://ift.tt/1Ui5ymL

Submitted April 28, 2016 at 07:30PM by visicalc_is_best

Event Driven Architecture - How Node.js works behind the hood

http://ift.tt/24kdI0Y

Submitted April 28, 2016 at 06:15PM by gnurat

nodejs app ideas

Hi!I'm learning programming in a collage and I have to create a node app as homework. I don't want to create a basic todo app like lazy students rather something useful.Do you have any cool ideas? :)

Submitted April 28, 2016 at 04:13PM by lacexd

Test Driven Development With Node, Postgres, and Knex (Red/Green/Refactor)

http://ift.tt/1N2U9WJ

Submitted April 28, 2016 at 03:52PM by michaelherman

NodeJs SQL Mason Query Builder

http://ift.tt/1UiUKVr

Submitted April 28, 2016 at 11:58AM by lee__mason

Node JS Development Company

http://ift.tt/1QCmHkd

Submitted April 28, 2016 at 10:49AM by OfficialGatesTech

ELI5: OAuth for persistent logins — Can someone help explain how OAuth login is secure, if all you're using to identify the user is a profile.id? (Passport)

Dear all,I am trying to understand how OAuth authentication for user login works. I am using Passport.js with Sails/Express. Let's take Facebook OAuth to keep things simple.Once the user approves my app's access to the Facebook API on their behalf, I receive some JSON back from Facebook that includes, e.g., their first name, their e-mail, and their profile.id.From the documentation I am finding online for Passport, it looks like when a user wants to register to your website using Facebook, you store the user in your database by calling User.findorCreate().So, if the user already exists, then great. If the user doesn't, then create a new user.In all the examples I've seen online, the way you create a new user (in your database) is just by creating a new user with profile.id. But how can that be!? There's no password! It's literally like registering with just a username!But how is that safe? Can't someone just spoof my profile.id (which is supposedly just a simple integer like 8832913) in their cookies and then login as me?If someone can please help me with the logic/overall flow/big picture of OAuth for registration & login, and what is actually being saved inside my database, that would be wonderful.Thanks.

Submitted April 28, 2016 at 08:51AM by LeeHyori

Wednesday 27 April 2016

Restify Model - A surprisingly useful model/collection adapter that builds routes and handles CRUD operations

http://ift.tt/1QBTKVD

Submitted April 28, 2016 at 04:40AM by gunther-centralperk

Book recommendation for developing with Loopback?

I've been doing research on the various libraries available for building API's on Node.js. I found Loopback today, and was hoping to find some good books on it, but have come up short on Amazon.Any recommendations or if anything actually exists?

Submitted April 28, 2016 at 03:08AM by Brainfestation

Node app with TypeScript / Typings

So I've written a node app using a lot of new ES6 features, and it was a lot of fun. I then discovered TypeScript, and it looks like just what I want.Are there any up-to-date guides describing how to setup a node app using TypeScript? I'm not looking for TypeScript language tutorials... as I understand TS requires definition files, and there's a new system out there to fetch them (typings). With pure JS you just need to define your node modules in package.json, but with TS and definition files... how do I manage those within my project and my build system?The only examples I've found use tsd instead of typings.

Submitted April 27, 2016 at 11:24PM by DigitalDolt

How to scale a node.js app?

Hi,I'm currently building a small multiplayer game like agar.io with node.js and socket.io. It's early in development, but I have some questions about scaling once it is released.When there are less than 80 people playing my game, they all play together and everything works fine.But what if there are 1,000 players online? I think I'll need to:Split players across different "rooms" (e.g. one room = 100 players), otherwise the game would be too difficult to play.And probably split the "rooms" across different servers (e.g. one server = 5 rooms) for better performances.However I have no idea how any of this works... Any advice or ressources to share on these subjects? I'm currently hosting the game on Heroku if that makes any difference.Thanks!

Submitted April 27, 2016 at 07:11PM by yukuzuna

Functional Programming on the backend?

Hi, I was wondering if anyone likes to program with JS in a function style, particularly on the backend. I'm concerned that the blocking aspect of copying data structures around, to maintain pure functions, will result in poor performance as it blocks the single-thread.What are your thoughts? should i just aim for a good semi-functional middle-ground?

Submitted April 27, 2016 at 06:30PM by awhoof

Node noob, help with practical use of tty.js?

I'm playing around with a Raspberry Pi 3, using it for a small serial terminal server, with 4 USB to RS232 dongles hanging off, connected to console ports on various pieces of network gear. The Pi3 is great here, since it's got integrated WLAN. So, it's really an OOB console server - connect to its WLAN (created with hostapd) and go.But I didn't come here to bore you with that stuff. I found and started playing with tty.js, and got it working fairly easily, even with TLS 1.2 between my browser and the app. Great so far.So, it's very nice that I can launch a terminal that's effectively an xterm on the Pi. But, I'd rather have some additional buttons that would launch individual console sessions.Ideally, 4 buttons along the top alongside the stock "Open Terminal" button. These buttons should launch a terminal that would execute something like "telnet localhost 7000". Essentially, instead of the web-ified equivalent of xterm, I'd like to have:xterm -e "telnet localhost 7000" So, here comes the noob stuff. In order to accomplish this, where do I start? Should I be looking to simply modify the static HTML bits included with tty.js? Am I barking up the wrong tree with tty.js?Cheers and thanks for at least getting me pointed in the right direction!

Submitted April 27, 2016 at 05:21PM by microseconds

In Defense of .js: A Proposal for Node.js Modules

http://ift.tt/26tlyHv

Submitted April 27, 2016 at 04:19PM by joshmanders

NodeJS: Native Bindings

http://ift.tt/1T4xOnz

Submitted April 27, 2016 at 02:38PM by michaelherman

What's new in Node v6? From a developer's point of view

http://ift.tt/1pE80qX

Submitted April 27, 2016 at 08:03AM by gergelyke

Tuesday 26 April 2016

Node Hero - Node.js Database Tutorial

http://ift.tt/233izAY

Submitted April 27, 2016 at 06:13AM by sogoruaiu

Breaking changes between v5 and v6

http://ift.tt/1pDodg8

Submitted April 27, 2016 at 01:32AM by a0viedo

missing node version manager for fishshell

http://ift.tt/1Tcumry

Submitted April 27, 2016 at 12:16AM by bucaran

Make request to other internal endpoint

Hi guys,TL;DR: I want to make a call to an endpoint on the same node.js-server.Basically, you can skip everything between the two lines. That's just some extra context.I'm working on a project in node.js that renders pages on the server-side (using EJS) for clients that are visiting through the browser. Soon, our web-application will also have a mobile-app on which pages are rendered on the client-side (so all I have to do is send json).So for all functionality, I will end up with two endpoints;(a) one endpoint that just responds with JSON.(b) one endpoint that responds with a rendered pageThe exact JSON generated in (a) can be used for rendering the page for (b). I want to implement the (b)-endpoint as follows: Make an internal api-call to endpoint (a). Use the result from this api-call (the json) to render the page. I know that this is probably not the best way to do it, but I would however like to know how it's done just for the sake of the argument.I have (b) implemented as follows: router.get('/getProblem', isAuthenticated, function (req, res) { https.request({ host: 'localhost', //eventually I would like to extract the host, port and path from the req.headers-object but for now I'm just trying to make this simple hardcoded request work. port: 3000, path: '/problem/req.query.problemId', method: 'GET', headers: req.headers },function(res) { console.log(res); //do stuff with result }); And (a) is implemented as follows:router.get('/problem/:id',isAuthenticated,function (req,res) { problemService.getProblemByProblemIdAndCompanyId(req.params.id, req.user.companyId).then(function (problem) { res.jsonp(problem); }) }); Calling http://localhost:3000/problem/1 works as expected and shows a json in my browser. However, calling http://localhost:3000/getProblem?problemId=39666 produces the following error on the server: GMT uncaughtException: socket hang upDoes anyone know how I would go about this? I also tried using the request-library without any luck.Kind regards,Duffman-

Submitted April 26, 2016 at 11:15PM by Duffman-

Node.js v6.0 released

http://ift.tt/1Sqk2zQ

Submitted April 26, 2016 at 08:18PM by Bieb

Node v6 is coming out today with ES6 support!

https://twitter.com/thealphanerd/status/725020461617270785

Submitted April 26, 2016 at 07:18PM by kripod

Having problem in understanding callback functions and assigning functions to variables

Program #1:-function placeOrder(orderNumber) { console.log('Order Number :', orderNumber);cookAndDeliver(function() { console.log('Delivered order :', orderNumber); }); };function cookAndDeliver(callback) { setTimeout(callback, 3000); };placeOrder(1); placeOrder(2); placeOrder(3);Output:- Order Number : 1 Order Number : 2 Order Number : 3<3 seconds delay>Delivered order : 1 Delivered order : 2 Delivered order : 3Program #2:-function placeOrder(orderNumber) { console.log('Order Number :', orderNumber);cookAndDeliver(function() { console.log('Delivered order :', orderNumber); }); };function cookAndDeliver(callback) { setTimeout(callback(), 3000); };placeOrder(1); placeOrder(2); placeOrder(3);Output:- Order Number : 1 Delivered order : 1 Order Number : 2 Delivered order : 2 Order Number : 3 Delivered order : 3<3 seconds delay>In program #1 'callback' is passed. In program #2 'callback()' is passed.What is the difference in 'callback' and 'callback()' ?? Why is the output different??

Submitted April 26, 2016 at 06:49PM by pranjalworm

DigitalOcean Hosting: Suitable for Enterprise Solutions?

What do you guys think? Would Digital Ocean be suitable for a mid-size enterprise solution? I'm looking to get into creating information management solutions for medium sized companies and want to know whether it is technically wise to use something like Digital Ocean to host the application.

Submitted April 26, 2016 at 03:16PM by snahrvar

Projects to learn networking programming?

what are the good project/apps to do in order to learn networking programming? Ive written a simple proxy in python, but want to explore more in this topic. Also, Ive made command line apps and some simple web apps but i feel like im still stuck at beginner level. what kind of projects should i do to help me get to intermediate or advanced level?

Submitted April 26, 2016 at 02:35PM by shangsunset

How to monitor a file for modifications in Node.js

http://ift.tt/1O9nMkI

Submitted April 26, 2016 at 01:16PM by shsh3

error-shout-bot - a npm library that lets you use Telegram IM to send error messages from your app

http://ift.tt/1TaSkUb

Submitted April 26, 2016 at 12:00PM by witnessmenow

Which are the less explored fields and/or applications of NodeJS that may be worth researching?

NodeJS has fascinated me on a level that I really started considering to write my BSc dissertation about a NodeJS-related theme.Without giving any precise themes, but rather just leading me: what are those fields and/or subjects that are only partially researched about NodeJS?

Submitted April 26, 2016 at 10:47AM by KatamoriHUN

Node.js instead of PHP ?

For my next project I want to use node.js but there are some things I don't understand or would need some more information:Is node.js running as a service on a linux server? Will the configuration work the same way? (I know about apache with sites, confs, mods,)How can I hide my javascript code from the client? (like in PHP only the result will be shown to the client and not the php code itself). But as I know from Javascript you can open a site an easy take a look at the Javascript in the source. Will the server side code written different to prevent this?Node.js is only single threaded? Can this cause problems?Can you recommend me a good tutorial, book, video,.. that is up to date and is looking at the programming language and also about security, database connection,...What I need to do:Present the user a webpage where he can input some dataThe data should be stored in a mySQL databaseLet him search through this dataBuild a PDF or DOC form from the dataThe last time I programmed a webpage was in PHP and this was several years ago. But I want to use something modern and innovative. I know about Java and Javascript syntax. I also like the idea of using the same programming language on the client and the server side.Any help will be appreciated.

Submitted April 26, 2016 at 09:33AM by dr34mup

Please help me to understand node.js better

There are some things I don't understand or would need some help:Is node.js running as a service on a linux server? Will the configuration work the same way? (I know about apache with sites, confs, mods,)How can I hide my javascript code from the client? (like in PHP only the result will be shown to the client and not the php code itself). But as I know from Javascript you can open a site an easy take a look at the Javascript in the source. Will the server side code written different to prevent this?Node.js is only single threaded? Can this cause problems?Can you recommend me a good tutorial, book, video,.. that is up to date and is looking at the programming language and also about security, database connection,...What I need to do:Present the user a webpage where he can input some dataThe data should be stored in a mySQL databaseLet him search through this dataBuild a PDF or DOC form from the dataThe last time I programmed a webpage was in PHP and this was several years ago. But I want to use something modern and innovative. I know about Java and Javascript syntax. I also like the idea of using the same programming language on the client and the server side.Any help will be appreciated.

Submitted April 26, 2016 at 09:18AM by dr34mup

Any good, simple tutorials on getting started with Passport authentication?

I've tried to understand the documentation but it seems like a bit of a mess. If there are any tutorials out there that you know of, that would be a great help. Thanks!

Submitted April 26, 2016 at 09:02AM by vhexs

Should I choose Q or Bluebird as Promises library?

http://ift.tt/1YRmzDC

Submitted April 26, 2016 at 08:15AM by bytearcher

Monday 25 April 2016

These herbal products are herbal medicines which stops premature ejaculation without any side effects, are natural capsules for better and enhanced ejaculation

http://ift.tt/1YRdieQ

Submitted April 26, 2016 at 05:46AM by hashmimr2

Want a docker image for node that's under 20mb? Unlike the official ones at >200mb? We are publishing updated super-slim images

http://ift.tt/1NMwNPG

Submitted April 25, 2016 at 09:56PM by gileze33

Loopback: Find & Sift - filtering results on related object's properties

http://ift.tt/1pyYTrv

Submitted April 25, 2016 at 08:44PM by nprincigalli

Structuring an Express app to be scalable

I'm an instructor at a programming bootcamp, and until now I've been using Express exclusively for creating small RESTful API servers. I want to spend more time learning/understanding Express in terms of server-side rendering so I can teach that as well. I started in the world of Django, which is very opinionated and did a lot of the bootstrap work for you, so I'm trying to understand the best way to structure an Express app in preparation for it to become large, perhaps even very large.In Django, you modularize your project by splitting it into apps and adding the apps to the setting's installed_apps array. Each app has its own models, views, and templates directories. This structure makes sense to me, where each "app" is an individual, standalone (or nearly standalone) component of the whole project, like having an "authentication" app whose only job is to do authentication, an "emailer" app whose only job is to send/route emails, etc.How would you accomplish this same structure with Express? So far I've only ever run a single express server app on a port and mounted my middleware, routes, Mongoose models, etc. on it, but never other express apps.I'm wondering if there's a solid resource I can refer to to learn that kind of structure. The only hint I'm finding so far in the docs is something about "mounting" other apps on top of a main express app, but if I could get some examples (even if it's pseudo-code), that would help me tons so I can learn it well enough to teach it.For example, if I wanted to organize all the views/templates, mongoose schemas/models, and routes for an "authentication" app to be separate from the main app's views/templates, schemas/models, and routes, how would I go about doing that?Thanks in advance!

Submitted April 25, 2016 at 08:39PM by bobziroll

Working with MySQL in Node.js. A collection of my favourite practices.

http://ift.tt/1T0fYCf

Submitted April 25, 2016 at 06:56PM by kAf4mGoIgCKt

Indexing Mongo for Production Performance with Node

https://www.youtube.com/watch?v=z9-9PCaEpbU

Submitted April 25, 2016 at 06:13PM by joshowens

setInterval is causing process.nextTick to take several seconds.

I found that whenever I was trying to query the database it was taking roughly 4 to 5 seconds to get the results. I tracked this down to a process.nextTick call. After spending way too much time trying to figure out why it was causing such a long delay I remembered about a talk I vaguely remember watching several months ago.It involved the Event Loop and how it will wait for events or something along those lines, but it mentioned timers specifically. Once I remembered that I know where my problem came from, a setInterval timer with a 5 second delay. I tested to see when I get the query results back, and I seem to get them back immediately after the timer is called.I know timers are called first, and that nextTick callbacks are processed at the end of the event queue. But why does the nextTick get blocked by the setInterval call when it still needs several seconds to expire?

Submitted April 25, 2016 at 08:09AM by NullField

Sunday 24 April 2016

What serverless database should I use?

I'd like to use a serverless database for a node.js project: I'd like something simple to setup and use, and would love to keep my database in a regular file (mostly for simplicity), rather than having to depend on an external server.I've played around with the following:SQLite: I don't feel too much like using a SQL DB, it feels like a lot of work just to define the tables, and a pain every time I need to change some columns of one. It'd be perfect, though, if I had to go the SQL way.UnQLite: I've read that it's quite immature and unstable.LevelDB: it seems really nice. Most of the LevelDB related projects are very old though (with the latest commits from a couple of years ago), and I've already run into a few odd bugs with some of these.What's your experience?Is going for SQL worth it in the end?Should I give up and use a DBMS like MongoDB?Is LevelDB the best available option? Is it even still alive? It doesn't seem so...

Submitted April 25, 2016 at 02:42AM by oroep

Just curious: What's the hold up with the latest V8 Es6 support in node?

I read a few months ago that V8 was up to 90-something percent ES6 support. Not knowing much about how the node development process is, I'm wondering why it's taking so long to for node to catch-up.Does node have to do something for each es6 feature added? that would seem odd.

Submitted April 25, 2016 at 12:33AM by get2workUslacker

Any Node BlogGing Frameworks?

My application is built on node. I now need a few public marketing pages(no prob) and a blog.Are there any good boxes blogging frameworks for node? Do most people link off to an external blogging tool like WP? Do most people build a blog from the ground up? Thanks

Submitted April 25, 2016 at 12:15AM by HoneyBadger08

Some quick thoughts on the V8 performance claims

http://ift.tt/1VMxuky

Submitted April 24, 2016 at 09:40PM by alexhultman

You can install node v6 using NVM

http://ift.tt/1SlA7qr

Submitted April 24, 2016 at 07:41PM by kAf4mGoIgCKt

Bulding A Rest API

I have built Rest style API's in node for a while now however, i've never really followed a proper syntax for rest. Are there any good resources on showing the best way to implement one in node?

Submitted April 24, 2016 at 01:23PM by Tetrominos

How do I reject requests to my API (Express) from everything other than my app?

I've built an API in express and would only like to accept requests from my own app. For example, using Postman or direct calls in the browser URL should be rejected.How can I do this? Is this a cookie thing and I need to store the sessions another way? Or perhaps CSRF tokens? Not really sure how to achieve this. Any help greatly appreciated! Nice one.

Submitted April 24, 2016 at 12:19PM by owenr88

Weekly Update - Apr 23rd, 2016

http://ift.tt/1r9oQPU

Submitted April 24, 2016 at 08:35AM by gergelyke

NodeConf London 2016 - Wed 11th May 2016

http://ift.tt/UlLnIN

Submitted April 24, 2016 at 08:46AM by gergelyke

Saturday 23 April 2016

When should I use normal functions vs asynchronous functions

I have been using Node in 2 projects but I usually just use other peoples modules. This is why I don't really know when to use normal functions vs asynchronous functions e.g.function funct1() { //Do stuff here return (stuff here) } vsfunction funct2(callback) { //Do stuff here callback(argsHere); } Any help would be appreciated!

Submitted April 24, 2016 at 06:13AM by mre12345

Using socket.io and setInterval on my game server.

What happens when setInterval can't loop through all the code and emit everything it needs to before the next frame is called? What's the best way to work around this? Right now my server works fine with a couple people on, but what happens if hundreds or even thousands of people were on it, what's the best way to scale my app to make sure this doesn't become a problem?

Submitted April 24, 2016 at 03:39AM by node_newb

Watch out Ruby, Google's coming for you.

http://ift.tt/1SkYC74

Submitted April 24, 2016 at 02:51AM by paulhauner

Help figuring node.js out

I've never used node.js before so I'm hitting some roadblocks. I have a picture created client-side using javascript and I want to write it to a file. So far, I've figured out how to send a post request from my jquery script to the node.js app.js file, however, I'm not sure how to scrape / read the html at this point.Could someone help me with either passing an array through the post for node.js to get or a method of parsing the current html page with another package perhaps.If code snippets are needed, I can post them. Thanks!On a side note, looking forwards, after I read a save file with the fs package, how do I send that to the jquery / put it on the html page?

Submitted April 24, 2016 at 02:32AM by ludicsm

Deploy API to digitalocean from bitbucket

Hi there! I'm trying to find a solution wherein my REST API will be deployed in my DigitalOcean server. Whenever I post a commit, the server repo will be updated as well. I also have setup different branches for dev, staging, and prod environments. I'm using Nginx to server the API. Can you please help me achieve this or at least point me out to a comprehensive tutorial?Thanks a lot in advance! :)

Submitted April 23, 2016 at 08:29PM by c0d3-x

An opinionated "Rails-esque" Node JSON API framework

http://ift.tt/1Qg7F3C

Submitted April 23, 2016 at 08:02PM by zacharygolba

echoSteg | Node.js - The Anatomy of Inherits

http://ift.tt/1r7ZIJd

Submitted April 23, 2016 at 07:53PM by theCynx

Lightweight filesystem backup manager written in node.js

I would love to hear your thoughts and/or feature suggestions. At the moment, there is only a Rackspace Cloud Files provider, but if there is any demand more can be added. I'm thinking SFTP, AWS, local filesystem, ect.Features:Backup specific directories which targets specific types of files based on glob patterns. This allows you to easily ignore large cache and build directories.Backup to Rackspace Cloud Files (more providers coming soon). This keeps backups off the server itself.Manage backups in a central JSON configuration file. This can make configuring backups a piece of cake when managing multiple servers. Personally, I push this json file to a repo and just check it out on the server.Have immediate access to your files. You don't need to overwrite live files just to access a backup (e.g. Rackspace Backups).Super easy to setup.http://ift.tt/1pt1za4

Submitted April 23, 2016 at 06:25PM by psaia

How to use the net's socket object outside of its callback function?

First of all, I'm not even sure I"m asking this correctly, but here's what I want to do. I'll start with a "sketch" of the code:var net = require('net'); someObject.prototype.changeState= function(callback){ // I want to use the server to send some data when this object method is called callback(); } var server = net.createServer(function(socket) { socket.write("Echo test server! \n"); socket.on('data', function(chunk){ socket.write(chuck); console.log("Received: " + chunk); }); socket.on('end', socket.end); }); What I need to do is have the server permanently on once I start the node script, but when I call the changState method, I want to send some data on the socket. The only way I know that it works right know is creating the server object each time I call the changeState method, but that is not an elegant solution. Any recommendations? :)

Submitted April 23, 2016 at 03:42PM by MrZeratul

I just published a package to simplify making Trello-bots in node. Let me know if you like it.

http://ift.tt/1SqbeXb

Submitted April 23, 2016 at 02:17PM by JaegerBurn

IBM Watson Dialog Service

http://ift.tt/1iOQ5LU

Submitted April 23, 2016 at 11:38AM by Holybananas666

Friday 22 April 2016

Get near by recent tweets

http://ift.tt/1SzPqdU

Submitted April 22, 2016 at 11:13PM by siddharthparmar

[Help][Possibly Horrifically Embarrassing] Problem with Node requiring a file (likely normalize-package-data)

So I'll get right to it, because I think I messed up so terribly that I want to get this over with.Very frequently when cruising around in Node-based projects, likely after running npm install, I'll very frequently see '/favicon.ico - No such file or directory' in the terminal (and browser console as well). The only time I've ever even typed the word 'favicon' was when I was creating my personal website over a year ago.After doing some poking around, it seems to me that I somehow globally required Node to load in a reference / pointer to '/favicon.ico' through the normalize-package-data package. I'm assuming this because, unless Node has a serious affinity for favicons, the term '/favicon.ico' is being referenced in these seemingly unrelated packages:node_modules/browser-sync-ui/public/index.htmlnode_modules/browser-sync-ui/public/js/app.jsnode_modules/normalize-package-data/README.mdnode_modules/normalize-package-data/lib/fixer.jsnode_modules/sax/LICENSE-W3C.htmlAnd ones I'm unsure were already there or not:node_modules/express/node_modules/connect/lib/middleware/session.jsnode_modules/express/node_modules/connect/lib/http.jsnode_modules/gulp-rev-replace/test.jsnode_modules/connect/History.mdNow browser-sync-ui does have a comment in their app.js folder stating browsers always make a request to a url @ /favicon.ico, but I'm not sure if that is auto generated.This problem is happening for me whenever I run a php artisan server (building something in Laravel right now), the terminal spits out some 404 nonsense about /favicon.ico. So, fellow Node folks, did I mess up horrifically? Do I need to do a clean reinstall of Node / npm? Thanks for your help.

Submitted April 22, 2016 at 07:46PM by PDX_Bro

Complete Server-Side Programming Noob In Need Of Help

Sorry for my title being so vague , didnt want it to become extremely long. Basically , I want to learn server-side programming , and first off , Im not sure which language is the most effective , while not being very difficult to learn? Did i make the right choice by choosing NodeJS? Anyway , Are there any assignment-based nodejs training websites? If not , what is the closest website to that type you know?

Submitted April 22, 2016 at 07:51PM by Sphaaat

Lessons from Building a Node App in Docker

http://ift.tt/1pNekgp

Submitted April 22, 2016 at 01:43PM by johnmountain

Thursday 21 April 2016

Trouble with bson-ext's native function calling

Hey guys,So basically, I didn't want to install the entire VS Package from Microsoft (I did try the Microsoft Dev Tools, but they didn't work with node-gyp).So I purchased a basic 2.99 vps (which might be relevant, but I doubt it). [I'm pretty sure my code is at fault]I am using http://ift.tt/1WJ8HfY as a native binding.Everything has worked well so far, I installed GCC, make and ran node-gyp configure and node-gyp build. I am now including the file in my node app like so:var bson = require('./bson/build/Release/bson.node'); var object = bson.BSON.prototype; console.log(object.serialize('hey')) The problem is, I am getting this error: console.log(object.serialize({test: "turkey"})) ^ TypeError: Illegal invocation Which is weird because when I do console.log(object)I get:BSON { calculateObjectSize: [Function: calculateObjectSize], serialize: [Function: serialize], serializeWithBufferAndIndex: [Function: serializeWithBufferAndIndex], deserialize: [Function: deserialize], deserializeStream: [Function: deserializeStream] } Which these are the native functions from C++ that were built to bson.node. So it does look like the bindings were compiled correctly, I am just not sure how to call them now. I posted on bson-ext's issue tracker but it seems like there are no examples or documentation on how to use this binding. And my lack of knowledge with the prototype chain, I'm obviously missing something here :(. I've been stuck on this for the past several hours or so and was just going to say fuck it. But, I really want to see where I am going wrong here so I don't mess up in the future.Edit: When I do:var bson = require('./bson/build/Release/bson'); console.log(bson) -- I receive:{ BSON: [Function: BSON] }If that helps.. If you need me to run anything on the console, let me know!

Submitted April 22, 2016 at 03:51AM by BillOReillyYUPokeMe

npm install muro -g

http://ift.tt/1WIQD5U

Submitted April 22, 2016 at 12:34AM by mkoryak

pre-node fundamentals?

Hi,I've decided it would be interesting to learn node.js:) There are tons of resources available and that's all good... but I'm new to this web dev thing and I feel like there are some fundamentals that I should understand before even starting node.So, here I am! What do I need to know, what background should I have, etc. I am reasonably comfortable with JavaScript, btw.Please feel free to be as basic as you want, like starting off with understanding what a web server is, what HTTP is, and so on.I appreciate any and all input!thanks:)

Submitted April 21, 2016 at 11:29PM by LearningMeNode

Pretty ESLint output

http://ift.tt/1qTVepH

Submitted April 21, 2016 at 11:16PM by sindresorhus

The Birth & Death Of Javascript [2014]

http://ift.tt/1jOe09E

Submitted April 21, 2016 at 07:27PM by letsencrypt

Can someone give me the big picture with pagination? (AngularJS Sails)

Dear all,I understand how to paginate with, say, the Waterline ORM in Sails (e.g., {page: x, limit: y}) and how to do front-end pagination with AngularJS. However, I am not sure how pagination on the front and back will interact.Suppose we have 1000 records in total that match some query.In the user interface, we can only comfortably show 20 per page.With these two things in mind, how could we generate pagination in order to maintain a fast and snappy user experience?It seems we should not be sending 1000 records back to the client and then doing front-end pagination on these 1000 records. Rather, we should just retrieve something like 60 records at a time and then do front-end pagination on those 60. If the user decides they want more results (travels past page 3), they can query the database for another 60 results and the pagination links would reflect the additional 60 results that come into the front-end data model.If someone could help me with the big picture logic of how this would work (no need for super specific implementation details), that would be really appreciated.Thanks.

Submitted April 21, 2016 at 06:25PM by LeeHyori

[Help]ERROR CONNECTION REFUSED (Steam Bot)

Hey, my console says: Error: connect ECONNREFUSED 127.0.0.1:3306 But everything is right. MySQL login is right, Bot login is right, API key and domain is right. (I censored it with xxx) http://ift.tt/1Sw7Xb4

Submitted April 21, 2016 at 05:15PM by proxitis

Redis connection singleton?

Hi I want to use redis in my new node.js app (probably using ioredis package) The way I understand it, every time I create a new "Redis" object, a new connection to redis is created and maintained. I figured the best way is to implement some sort of singleton connection (connection pool is unnecessary because the best pattern is one connection per app) Do you think that's the best approach? I thought there would be lots of info about that kind of stuff but I couldn't find really. Thanks!

Submitted April 21, 2016 at 12:38PM by tzvikam

Profiling NodeJS applications

http://ift.tt/210545F

Submitted April 21, 2016 at 12:04PM by ghaiklor

Oauth authentication for Node js

Hi,I'm planning to create a simple REST api using node js. The plan is that this REST api will be consumed by web apps(using angular) as well as mobile apps(Android, ios etc). Im planning to implement the oauth authentication.I'm new to nodejs. Could you please help with the below questions.How should i approach the oauth authentication?Should I implement the ouath at the Node level(using Bell or Passport) so that this authentication will be used accross all access points(web, mobile app etc)?Or should I implement the oauth at the client level(angular, android app) and pass the authentication info to the node layer(idea is to avoid unauthorized api access).What is the ideal approach? Server side or client side?Is there any sample guides available for the scenario I explained above?Thanks in advance.

Submitted April 21, 2016 at 12:08PM by paappa_thaappa

Create your cluster in 2 minutes: Getting Started with Hazelcast and Node.js

http://ift.tt/1MK7NOh

Submitted April 21, 2016 at 12:28PM by _shadowbannedagain

Need some help with Express rendering data with Jade

Code -> http://ift.tt/1T11odW My problem is usernames not rendering. It seems that something is wrong in the forEach function, since the username does show up after pulling it from the DB. Anyone willing to help a noobie? PS. Next time I have a question, is this the place to ask? Or is StackOverflow better for questions and this subreddit more of a share-articles kinda thing?

Submitted April 21, 2016 at 10:56AM by CodeMessiah123

Wednesday 20 April 2016

Philadelphia Eagles trade five NFL draft picks for Cleveland Browns' No2 spot

Guardian sportWednesday 20 April 2016 14.53?EDTLast modified on Wednesday 20 April 2016 14.59?EDTThe reinvention of the Philadelphia Eagles continues with the team acquiring the No2 overall pick in next week’s draft from the Cleveland Browns. In return for the No2 spot, the Browns get the Eagles’ No8 pick and third- and fourth-round selections this year as well as Philadelphia’s first-round pick in 2017 and second-rounder in 2018. The Eagles pick up a conditional fourth-rounder from Cleveland in 2017. The move means that the Eagles are probably moving for a quarterback with Jared Goff and Carson Wentz expected to go No1 and 2 in this year’s draft. The Los Angeles Rams have already traded up to get the Tennessee Titans’ No1 overall pick. Most pundits expect the Rams to go for Goff, which would put Wentz in line for a place on the Eagles roster. Philadelphia already have a solid stock of quarterbacks. Sam Bradford, the No1 overall pick in 2010, is due to make $17m this year while Chase Daniel is one of the league’s highest-paid back-ups. If the Eagles do pick Wentz or Goff, he is likely to sit on the bench before making the step up to starter. The team’s executive vice president, Howie Roseman, appeared to confirm that in a statement after the move was announced. “Let me be clear, Sam Bradford is our starting quarterback,” Roseman said on Wednesday. “We told Sam that. We intend to support him and the moves we made this offseason we believe will give us a chance to compete this season.” The Eagles employed such a tactic when they selected Donovan McNabb No2 overall in 1999. Oddly, the man McNabb backed up that year was the Eagles’ current head coach, Doug Pederson. The Eagles have already started to rebuild elsewhere. Chip Kelly was fired in December last year and the team will be led by the former Kansas City Chiefs offensive coordinator Pederson this season.or create your Guardian account to join the discussion.This discussion is closed for comments.We’re doing some maintenance right now. You can still read comments, but please come back later to add your own.Commenting has been disabled for this account (why?)I don't watch enough college football to know what else is out there. But perhaps the Browns were the only team prepared to do a deal with the Eagle, who perhaps have their eye on someone else who would otherwise go 3-7? They have two very decent QBs as is, and the limited amount of know Wentz and Goff doesn't suggest they're going to be that big a deal. Meanwhile, other teams really do need a QB, qhich would explain why they're expected to go so quickly. Wow eagles have been giving away too many draft picks in desperation, watch the death spiral to come I never thought I'd say this: Great move Browns. Both quarterbacks are really no better than late first round/early second round prospects. Hey, I completely agree that the EAGLES gave up that much for the very purpose of drafting a QB...Okay, so then why the HELL did they sign Very-Often-INJURED Bradford to a $36 MILLLION /2 year extension? ( DUH, Eagles Ownership! ) Bradford....Solid stock....since when? Has he ever played 1 COMPLETE season? No, I DO ask that seriously. Doesn't sound like much of a vote of confidence in Bradford to me. The Eagles seem to be willing to give up an awful lot for this move up. If the pick is a bust it'll haunt them for years. Good move Brownies!!Michael Kors Rugzakken You're right. Since they're not going to get Jared Goff; already signed RG3 to a contract; might as well trade for a ton of goodies!

Submitted April 21, 2016 at 03:36AM by yeyele

Test your JavaScript modules simultaneously in 32 different versions of Node.js

http://ift.tt/1MIAECH

Submitted April 20, 2016 at 08:30PM by mkmoshe

Is there a node equivalent to PhpMyAdmin?

So I set up my first node server on Digital Ocean and I got my app running. It uses MySQL, and so I'm wondering if there's a node equivalent to PhpMyAdmin where I can manage the MySQL DB through a nice interface.I'm a fan of PhpMyAdmin, but not a fan of installing a full LAMP just to use this one tool. Any guidance would be much appreciated!

Submitted April 20, 2016 at 07:27PM by snahrvar

Setting up MySQL GUI for my server

Hey guys, thanks to your freakin beautiful people, I've been able to learn node, create an app and launch it on DigitalOcean. Now I'm wondering if there's a way to setup a GUI where I can easily do CRUD operations.Now I know some people will say "just use the command line" and I'm personally fine with that, but there's someone else who's less technical who needs to add info to the DB as well, so that's where it really becomes helpful.As always, thanks for the wonderful advice!

Submitted April 20, 2016 at 04:38PM by snahrvar

Help. Trying to decipher .net encryption

I have some encrypted data from a .net application using Rijndael AES with a 256bit (32bytes) symmetric encryption key (obviously I have this publickey). Im using node and trying to decrypt this. The developers have offered a c# method of decryption, but they dont work in node so cant offer advice here.Their code ispublic static string Decrypt(string toDecrypt) { byte[] keyArray = UTF8Encoding.UTF8.GetBytes(_mySymmetricPublicKey); // AES-256 key byte[] toEncryptArray = Convert.FromBase64String(toDecrypt); RijndaelManaged rDel = new RijndaelManaged(); rDel.Key = keyArray; rDel.Padding = PaddingMode.PKCS7; // better lang support ICryptoTransform cTransform = rDel.CreateDecryptor(); byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return UTF8Encoding.UTF8.GetString(resultArray); } Can anyone point me in the direction of what module and method may work here?

Submitted April 20, 2016 at 05:04PM by itsmoirob

Why im diving into NodeJs Part 2

http://ift.tt/1WFuwxa

Submitted April 20, 2016 at 04:24PM by lee__mason

Which side-effects should I expect by doing npm install before stopping a node app?

I was thinking on cutting some downtime by installing new modules before stopping the application. Should I expect any weird behaviour?

Submitted April 20, 2016 at 03:37PM by ED-209-MKII

[QUESTION]AngularJS vs EJS

Hey guys,Not sure if i got this correct but can angular be replaced by EJS(Are they functionally the same thing?)ThanksApologies for the noob question i am busy learning

Submitted April 20, 2016 at 03:49PM by Swiftzn

Hey r/node! I'm the author of Nodal - an open source Node.js project for creating backend APIs SUPER easily I've founded a startup and I could use your help!

Hey r/node :)My name is Keith Horwood, and I've been a pretty heavy open source developer for a few years now. You can see most of my work at http://ift.tt/1STsjbx've written a few articles on web development and architecture:Single-Page Applications: Building a Web Stack That WorksHello, Nodal — Building Node.js Servers for EverybodyRealtime Doesn’t Belong Everywhere — Build Scalable API Services in Node.js with NodalI most recently spoke at O'Reilly Fluent 2016 with an in-person version of this article:Using Graph Theory to Build a Simple Recommendation Engine in JavaScriptI founded a startup earlier this year based upon idea of abstracting away what I refer to as "solved problems" that engineers collectively waste hundreds of thousands of hours building and rebuilding solutions for. I think the answer to solving these problems starts with shareable, extensible but heavily opinionated open source software. I don't want to give too much away yet, but what I do want is your help.Right now I'm looking for any developers that are willing to take a few minutes out of their day to talk via e-mail. If you'd love to help play a small role in building a brand new, developer-centric company please send me a message on Reddit with:A) Your nameB) Your company (totally fine if between jobs!)C) Your job title, if applicable (Front-end? Back-end? CTO?)D) Your experience level (years writing code)E) Your e-mail addressThank you SO much! I really appreciate any and all help you're willing to give. If you'd like, I can continue to keep you up to date afterwards on progress. :)Cheers! - Keith

Submitted April 20, 2016 at 02:13PM by keithwhor

Tuesday 19 April 2016

Free automated HTTPS for NodeJS made easy.

http://ift.tt/1Q1ZPeq

Submitted April 20, 2016 at 04:59AM by Piercey4

Expressed: a new node.js/Express boilerplate for easily creating APIs. Includes automated testing code coverage and documentation

http://ift.tt/1UJwnOQ

Submitted April 20, 2016 at 03:10AM by enkarta

EclairJS = Node.js Apache Spark

http://ift.tt/1ThnWtL

Submitted April 19, 2016 at 06:06PM by dcf75

Building a Node.js module with promises (and not breaking them)

http://ift.tt/1SXwVxv

Submitted April 19, 2016 at 05:32PM by dtolbert

Using Node to support conversational interfaces and bots

http://ift.tt/1SQXvIo

Submitted April 19, 2016 at 04:52PM by mrwhitespace

Use api based web frontend with express or not?

I am developing application stack with nodejs and express, I will eventually have clients on android and iOS so I need to do it api based, right? Should I use api for web frontend also or develope it as fullstack application and api for android and iOS only?

Submitted April 19, 2016 at 08:08AM by Viped

Monday 18 April 2016

Run a node js script on a raspberry pi via ssh?

Hello im running a node script on my raspberry pi via putty but the problem is when I close putty on my pc so does the node script and another thing if I do manage to kleep it running and then restart my pc how can I look at the same console that putty was in before I restarted.

Submitted April 19, 2016 at 07:54AM by seiterseiter1

Why in Node.js you need to do asynchronous operations

http://ift.tt/1QjpSgB

Submitted April 19, 2016 at 07:26AM by bytearcher

Let node run a shell command and display stdout in the browser (looking for libraries/best practices)

This is something I've been wondering about quite some time and I need it for a tool I'm currently building.I want to use node to run a system command and want to send the output of the command (stdout, and preferable stderr too) to the browser, live.Some tools that use this are for instance CI tools like CircleCI, and I think Heroku does something similar.I thought about logging the output to a file, tailing that file, and send it to the browser using a websocket though that somehow feels a bit hacky.There must be libraries out there that do this or similar things, but I can't find them.Any ideas about libraries or best practices for this?

Submitted April 19, 2016 at 03:46AM by beeman_nl

Supermarket approach to Dependency Injection

I'm working on a Node.js application that is slowly growing in size. I've been learning Node.js for the last 5 months, and am interested in design patterns and approaches that should make my code easier to maintain, easier to test, and simpler to code.One thing I've seen a lot of is Dependency Injection, both to help with a loosely coupled modules and specifically test mocking. Learning about these processes seems overwhelming and people start talking about factories, mixins and design rules, which due to the complexity of the solution are ok to break every now and then.As a quick background:I saw this video on Testable Javascript by Mark Trostler from Google, and it was great. He explains very well the challenges of architecting your application for testability, a great watch.A good pattern he shows is your application really has two phases, the 'creation' phase and the 'use' phase.During the creation phase, which only happens once, you build and initialize key components that your application will use. This is where dependency evaluation occurs and you are building a collection of objects you can later pass to functions to help them operate correctly.The issue I see, is when it comes to dependency injection, even when using libraries like cujoJS or your own DI model, is that the complexity of your application increases rapidly. This is predominantly to enforce the "Interface Segregation Principle" where "No object should be forced to depend on methods it does not use".The Supermarket approach to Dependency Injection:The idea I'm thinking about is a gross simplification of Dependency Injection, and my concern is my naivety and inexperience is fooling me into thinking it is a good idea, would love to hear your feedback.When your application is starting, during the 'creation' phase, you create an object that will hold references to all interfaces used by your application.Lets say your application had a UserController function which could use one of two UserRepo implementations, UserRepoRedis and UserRepoS3. During your creation phase you work out you want to use UserRepoRedis so you instantiate the function and add it to the Supermarket object at appSupermarket.UserRepo.Then when your UserController object initialises, it would be passed the appSupermarket object and initialize like this:var UserController = function(appSupermarket) { this.userRepo = appSupermarket.UserRepo; } ; That is a simple view, and you would test if appSupermarket.UserRepo was typeof 'function'.Over time, as your application grew, you would continue to build up the interfaces under appSupermarket, and just let functions pick and choose which functions and objects they want to pull out of there.From a testing point of view, it is very easy to mock up the appSupermarket object.It looks like it breaks the "Interface Segregation Principle" by giving functions access to many more functions than they need, but we aren't 'forcing them to depend on methods they do not use', rather we are offering more methods than they need, they can choose to ignore them.It would be possible to add some code at the beginning of a module to ensure it can find the required modules within appSupermarket that it needs defined, and if it finds they aren't there it can handle that error. This gives us some manageability over which module needs which module without getting too complex.Apologies for the wall of text. I sometimes think some programming patterns can get caught up in themselves and to me this seems to be something that can be done simpler. I just want to start off the conversation and see what others think.Edit: formatting

Submitted April 19, 2016 at 03:05AM by FourtyTwoBlades

Fix TypeScript Autocomplete for RxJS Operators And Helpers In NodeJS

http://ift.tt/1YDJPoq

Submitted April 19, 2016 at 12:59AM by meligy

Nodejs and Underscore on server or as frontend

Its better to use underscore for filtering objects on the server or on the front end? Should I install it via npm or via bower? No idea what is better here. Thanks Guys!

Submitted April 19, 2016 at 01:10AM by poorman321

Do you do bulk insert/requests when you need to validate all the data?

Do you allow for a bulk insert json POST request for instance, when you must look at each object and validate the data? Therefore, you must loop and block :/

Submitted April 18, 2016 at 08:08PM by awhoof

What make asynchronous code run faster than synchronous code ?

I understand the non-blocking part, you run your code more intelligently and you can deal with multiple request better.But lets say you run a bunch of instructions in node (operations on arrays), what difference does it make to run it sequencially or not if its run in a single threaded environnment at the end ? Shouldn't it be even slower using async for adding aditionnal overhead ?Is there scenario where running async code is actually faster than running sync code ? like when dealing with file system (read/write to the hard drive) ?

Submitted April 18, 2016 at 06:34PM by Jsnow25

What's the best way to host my node.js app?

Your friendly local node.js noob here. Thanks in part to this community, I have my first functional node.js app running on my local environment. My question is: what is the best place for a beginner to host his app? I use HostGator for my traditional sites.

Submitted April 18, 2016 at 04:56PM by snahrvar

REST Api authentication for your apps.

http://ift.tt/22HRyTs

Submitted April 18, 2016 at 04:33PM by rajayogan27

Passport, '/profile' isn't playing nice

var express = require('express'); var app = express(); var mongoose = require('mongoose'); var passport = require('passport'); var passportLocal = require('passport-local').Strategy; var bodyParser = require('body-parser'); var cookieParser = require('cookie-parser'); var session = require('express-session');var userSchema = mongoose.Schema({ local: { email: String, password: String } }); var User = mongoose.model('User',userSchema); app.use(session({secret: "imasecret"})); app.use(passport.initialize()); app.use(passport.session()); app.use(cookieParser()); app.use(bodyParser());mongoose.connect('mongodb://localhost/passport'); var connection = mongoose.connection; connection.on('error',console.error.bind(console, 'Connection Error: ')); connection.once('open',function(callback){ console.log("mongoose connected!"); });app.listen(3000); console.log("Magic on port 3000");//serialize users by there ID passport.serializeUser(function(user,done){ console.log("user serialized", user); done(user.id); }); //Find the user by there id, and deserialize the user passport.deserializeUser(function(id,done){ User.findById(id,function(err,user){ console.log("user deserialized", user); done(err,user); }); }); //signup passport-local configuration passport.use('local-signup', new passportLocal({ //The config usernameField: "email", passwordField: "password", passReqToCallback: true },function(req,email,password,done){ // asynchronous // User.findOne wont fire unless data is sent back process.nextTick(function(){ User.findOne({"local.email": email},function(err,user){ if(err) return done(err); if(user){ return done(null,false,null); }else{ var newUser = new User(); newUser.local.email = email; newUser.local.password = password; newUser.save(function(err){ if(err) throw err; return done(null,newUser); }); } }); }); }));passport.use('local-login',new passportLocal({ usernameField: 'email', passwordField: 'password', passReqToCallback: true },function(req,email,password,done){ User.findOne({'local.email': email },function(err,user){ console.log("user:",user); if(err) return done(err); if(!user) return done(null,false); if(user.local.password !== password) return done(null,false); console.log("DONEE"); return done(null,user); }); }));//routes app.get('/profile',isLoggedIn,function(req,res){ res.status(200).send({message: "wohooo you did iiiiit!", user: req.user}); }); app.post('/signup',passport.authenticate('local-signup', { successRedirect: '/profile', failureRedirect: '/signup', failureFlash : false })); app.post('/login', passport.authenticate('local-login', { successRedirect : '/profile', // redirect to the secure profile section failureRedirect : '/login', // redirect back to the signup page if there is an error failureFlash : false }));// route middleware to make sure a user is logged in function isLoggedIn(req, res, next) { // if user is authenticated in the session, carry on if (req.isAuthenticated()){ console.log("authenticated!!"); return next(); } // if they aren't redirect them to the home page res.redirect('/'); }I can NOT get /profile to work! it has a problem with the 'isLoggedIn' function (it isnt 'authenticated', but it is in the DB, and it is serialized correctly)

Submitted April 18, 2016 at 03:51PM by ThomasSmWatson

Trying Koa (A Hapi Users Perspective)

http://ift.tt/1WB0IBF

Submitted April 18, 2016 at 02:58PM by jstuartmill

Sunday 17 April 2016

Is www.slither.io built on Node?

I can't seem to find how slither.io is built - but i'm guessing Node. Can anyone clarify?

Submitted April 17, 2016 at 07:03PM by JOKE-JUDGE

Runtime JavaScript typization using Haskell functions definition

http://ift.tt/1STv7Wp

Submitted April 17, 2016 at 06:26PM by yarax

How to detect memory leak in NodeJS

http://ift.tt/1Fw9j2J

Submitted April 17, 2016 at 05:22PM by shsh3

spw | simple data throw module

http://ift.tt/1qQyKFR

Submitted April 17, 2016 at 03:40PM by indatawetrust

The Pinisher, a nodejs project reporting Twitter users

Hi ! I forked a nodejs project using Twitter's API and retweeting things with your keywords. I made it to run on a Raspberry Pi but it obviously run on any distro with nodejs.Instead of retweeting the search results it just signal them as spam.Why did i made it ? It was basically a joke when i was working on the retweeting bot but got tired of the quantity of porn stuffs being retweeted. At least the littles changes needed to making it work gave me a little nodejs experience.The project is on Github and i also wrote a little blog post about it in french.What do you think about it ? It was the first times i tried something in nodejs and javascript even if in fact i didn't make a giant work and the result isn't very usefull it was still very interesting !

Submitted April 17, 2016 at 03:02PM by Qsypoq

Redux server-side only

Have you ever tried build Node.js app (without front-end or server-side rendering) with Redux or similar patterns? If yes, can you describe your feelings about it? Pros/cons... etc. Thank you!

Submitted April 17, 2016 at 09:48AM by xPAdAMx

Saturday 16 April 2016

ZeroMQ vs IPC (node-ipc)

Hey guys, I found this thread: http://ift.tt/1Vt0aOJ I cannot find any benchmarks or performance differences between inter process communication, zeroMQ (or even Redis` Pub / Sub).I'm curious what would be more efficient (and faster) for local IPC. ZeroMQ or the node-ipc module?Obviously one would think node-ipc, but I was reading this benchmark and they are getting 480k + msgs/s. I cannot find any benchmarks for node-ipc so that's why I'm so curious

Submitted April 17, 2016 at 05:12AM by BillOReillyYUPokeMe

Why im diving into NodeJs

http://ift.tt/1QeDTMx

Submitted April 16, 2016 at 09:47PM by lee__mason

openg - A tiny utility to open the github page for an npm module

http://ift.tt/1SdIdxU

Submitted April 16, 2016 at 07:41PM by dbsweets

[Question] CasperJS doesn't seem to work

I'm on Windows 8.1 and I didnpm install -g casperjs it installed right but when I do this in cmdcasperjs --version I just getCan't open 'C:\Users\Sol' The username I've kept in my system has a space in it. But I also tried installing by downloading the .zip file from the website then manually setting the path variable but the error was the same. PhantomJS 2.1.1 is installed and works perfectly.Any ideas?

Submitted April 16, 2016 at 07:18PM by Sol_Invictus481

Hewer - A small, extensible, easy-to-use, zero-dependency logging library for node.js

http://ift.tt/1MzDWbe

Submitted April 16, 2016 at 04:22PM by m4tchs

Need help with Redis Pub/Sub load balancing and multiple instances

I really don't like to post on StackOverflow, and you guys have been great here already.Anyways, I'm using Redis with PM2 and have 3 node instances running in the US on 3 ports:My nginx load balancer:upstream websocket { least_conn; server 127.0.0.1:9300; server 127.0.0.1:9301; server 127.0.0.1:9302; } So, I run my app with PM2 and boom, these instances are up and running. Redis is also subcribed on each on each port (9300, 9301, 9302) -- so If a player connects to instance 3 (9302) and sends a message to a player that is on 9300; it will publish to that instance so that user is notified. Yada Yada Yada, basic Pub / Sub system down and working. Obviously this is only good if we get a ton of players...In any event, here are some problems I have:What if I wanted to add another server? I read this, but that doesn't take into account multiple instances, only multiple server's. I'm doing multiple instances here. (this is where I am confused)What if player A is on 9300 and player B is on 9302 and player B joins player A's game. (When I say game I mean my game is similar to Diablo 2 where it's instance based so lets just say "channel") -- is it possible to get both player B and A onto the same node instance without losing their ws connection? This way, I can save some latency without using Redis` Pub/Sub to notify the other instance to send a message. Or is this pre-mature optimization?Thanks for the long read... Now you probably know why I don't post on SO :)

Submitted April 16, 2016 at 08:15AM by BillOReillyYUPokeMe

Friday 15 April 2016

Architecture question about setting up two servers for one app.

So I'm not really a programmer, but I built this pretty awesome game with node and socket.ioBut I want to have two servers, one on the west coast and one on the east coast for best performance, and I want one server to be a load balancer and determine which server the client will connect to..The thing is I have NO idea how to do this, I've tried doing research on nginx and load balancing in general but I don't have the expertise to convert what I've researched into what I need..Does anyone know any middlewares that can help me accomplish this?How my game works right nowI run server.js on the server and the only routed page I have is the home page which then loads the game.So basically I want server.js to determine which server the client's IP is closer to, and then connect him to that server for the gameBut I don't know how to do this at all and my research isn't really working out. I'm looking for books, videos, articles, anything that can help me figure this out. Thanks.

Submitted April 16, 2016 at 05:32AM by node_newb

Show me how to build a simple hello world-ish outlook add in

Please delete if not allowed :)Has anyone built an outlook add in with node.js? If so, and if you can spare 1/2 hr - 1hr of your time then please pm me. I will compensate you for your time as long as it is reasonable.

Submitted April 16, 2016 at 12:42AM by rmuktader

Thoughts on an thread that put down node

I was curious about Agar.io and I found this thread:http://ift.tt/1SgeR4b you scroll down a bit to here, someone asked a question about nodejs. Which I thought was a perfectly valid question, but it looks like it got downvoted into oblivion.So, what really triggered me is not that the author chose C++ for the Websocket server. That is fine, but it's the post below that.Think that part of it is that only one process or thread can run at any given time in node. So, if you have a complicated multiplayer server, subroutines will start getting blocked.And alsoThe main limitation on a server capacity is CPUBut, cant clustering help fix that? Not only just clustering, but the ability to run multiple nodejs instances with PM2 and then using something like Redis for an in-data memory store to horizontally scale.The author has said each server has around "200 players", which are sending a ton of binary compressed data per second, but after looking at these benchmarks, 200 seems very little for one "server". Unless, each of his servers are single core?Anyway, I just felt like nodejs was put down unjustly in that thread and maybe I am wrong on some things, that's why I'm posting all this. I kind of want to hear what other nodejs developers think.

Submitted April 15, 2016 at 10:58PM by BillOReillyYUPokeMe

AdonisJs – A Laravel-ish Node Framework

http://ift.tt/1qvjVrX

Submitted April 15, 2016 at 09:40PM by romainlanz

The Node.js Event Loop, Timers, and process.nextTick()

http://ift.tt/1T9Yd6y

Submitted April 15, 2016 at 10:08PM by a0viedo

How Node.js created a model open source community

http://ift.tt/1MynLen

Submitted April 15, 2016 at 09:13PM by Mylo_Does

Node Crypto-Extra - Looking for feature suggestions

http://ift.tt/1YxZQfG

Submitted April 15, 2016 at 07:39PM by jsonmaur

Promises and performance

If i understand well, Promise is an async library that help structure code, but you won't get any direct performance enhancement from its methods except for Promise.all ?Using Promise and chaining a couple of ".then" and a ".catch" won't make my code more performant. However i can chain asynchronous functions using outside libraries like map or asynchronous each to gain performance.Is that right ?

Submitted April 15, 2016 at 07:40PM by bakunin95

Make sync

How I debug Node.js

http://ift.tt/23KU3XG

Submitted April 15, 2016 at 03:28PM by aneesiqbal

Test driven development in Javascript

http://ift.tt/1SjwzXF

Submitted April 15, 2016 at 02:16PM by rajayogan27

Any ideas for running a node.js app with a frontend without using a browser?

Hey,So I have created a system that starts up on a windows 8 PC and runs silently, I send it commands remotely to open and close Node applications. At the moment it starts the server and then opens chrome in kiosk mode and goes to the specific URL. This system is alright.. but.. chrome has been acting up sometimes, with updates, and sometimes not opening I'm not 100% happy with it.Does anyone have any tips, chrome apps? Windows apps? Chromium, wrappers? Anything really that would be a little more dependable than Chrome, but have the same support for front end JS and html5.Thanks!

Submitted April 15, 2016 at 10:03AM by emomooney

Thursday 14 April 2016

joshhunt contrib game strong

http://ift.tt/1RXFtYN

Submitted April 15, 2016 at 04:11AM by fwertz

How do I create the front end to my Node.js App

I have successfully connected my MySQL database to my Node.js app and now I am wondering how I can display the data I query into my existing html file. I am using Express on top of Node.

Submitted April 15, 2016 at 03:33AM by connorb14

need advice

is node good for ecommerce application or any large application and why ? +/- of using node over rails / any php framework ?

Submitted April 15, 2016 at 02:45AM by IKnowAGuyWhoKnowAGuy

"Why the restrictive license? · Issue #4518 · NodeBB/NodeBB" - Saw this linked in a NodeJS Facebook group, what's your opinion in the matter?

http://ift.tt/1YwmFAr

Submitted April 15, 2016 at 01:07AM by KatamoriHUN

How to get url from which the api was hit?

I have smth like that app.post(/api/leads, function((req, res){ console.log(res.url) <- what to put here to get url from which the API was hit })

Submitted April 14, 2016 at 11:56PM by poorman321

How to Setup Node.js App Automated Deployment and CI with PM2 for MVP's

http://ift.tt/1RX8tQp

Submitted April 14, 2016 at 11:12PM by tknew

[Sequelize] Best practice for Select, Join and Aggregate function ?

I have three models, Item, User and Ratings.// mxn cardinality User.hasMany(Ratings); Ratings.belongsTo(User); Item.hasMany(Ratings); Ratings.belongsTo(Item); So basically a user can rate an item. Now what I want is something likeSELECT id, AVG(ratings.value) FROM items LEFT OUTER JOIN ratings on item.id = ratings.itemIdWhat's the best way of doing it in sequelize ? I don't want to write raw query as it steals away the benefit of ORM and might cause incompatibilities with different databases. (I have such requirement for my project)

Submitted April 14, 2016 at 08:15PM by bogas04

Best approach for implementing a CLI app that calls an API secured by OAuth2

connection lost: the server closed the connection

Node Terminal Emulator

Hi all, Does anyone know if it is possible to create a terminal emulator in node, using something like, pty.js or tty.js, but without using socket.io or express..... i.e. a service that doesn't bind to a port. I cant figure out how to do it, and am new enough to node. Thanks in advance.

Submitted April 14, 2016 at 05:15PM by Johnnyb3G00d

Make a JavaScript function support both promise and callback styles.

http://ift.tt/1T64Zdv

Submitted April 14, 2016 at 11:41AM by sonnyp

Deploying?

So, i have been on the frontend for awhile, and it's quite easy to actually deploy things to a host. But a few months ago i taught myself Node and have been having good fun with it, until i actually finished my project.... Then the daunting question was: How the hell do i actually deploy a Node server? It seemed simple. I did some digging online and to my surprise i couldn't find a straight answer. Not one.I have a domain, i have a VPS, i have my project on that VPS (Thought it cannot actually run since it doesn't want to accept ES6 code for some reason, and i AM running the latest version of Node, tried Babel and still won't work) How do i deploy?Sorry if this isn't the place, i have just been looking, googling and searching left and right, but cannot seem to find anything.

Submitted April 14, 2016 at 11:44AM by sloansta

Wednesday 13 April 2016

What's your deployment setup like when using es6?

For instance, if your modules build to a dist/ folder, then do you just deploy that folder to your server? And do you deploy the normal src/ folder to npm?

Submitted April 14, 2016 at 03:19AM by awhoof

Some help with my mongoose schema?

Hello, I am trying to think of my database schemas that I want to use for my project I am working on while allowing them to grow in a smart way so that I dont have a tangled mess if the site grows.So right now I have a user, which has a password and a email ( for password recovery, but is optional)Now, I want the user to have a profile page which they can provide links to various things. Can mongo scale to where a user can add a custom link to their profile beyond the ones I define?So just to give an idea of how I see it, but not sure if its the proper way this is what I got.var userSchema = new mongoose.Schema({ username : String, password : String, email : String, social : { facebook : String, twitter : String, website : String, other : {} } })); I also want to allow a user to follow which I guess would be a new collection and just linking them with object ids.Any help would be appreciated.Thanks.

Submitted April 14, 2016 at 01:50AM by clandest

Simple authentication in node.js with a token only?

I'm developing an API that requires a very minimal amount of security that will be consumed by mobile clients. We have a separate server that handles user accounts and authorization, so I would like (if possible) to design an authentication system where the user (mobile app) only has to use a token to access the API. What are my options for this kind of authentication? What's the best way to set something like this up with node/express?

Submitted April 13, 2016 at 09:39PM by estebanrules

ESLint not completely indenting when using --fix

I'm looking at switching from JSCS/JSHint to ESlint (mainly so I have some compatibility between my dev environment and codeclimate). In the process I want to switch from 4 space to 2 space indenting. JSCS appears to do this flawlessly, but with ESLint I need to run it multiple times to get everything indented. --fix only seems to fix one level of indenting at a time.Am I missing something? How do I get ESLint to completely indent a file?

Submitted April 13, 2016 at 06:27PM by skarfacegc

Removing Complexity in your Node Routes

https://www.youtube.com/watch?v=YLA-cuvouCU

Submitted April 13, 2016 at 05:40PM by saulorama

A lightweight ORM which was made with comfort and performance in mind

Hello there,Lately, I have been involved in developing applications which shall execute many database queries in the background. I started off with Bookshelf.js, but after a while, its amount of methods just couldn't satisfy my needs anymore: most of the time, I had to use raw Knex queries instead.After seeking through solutions available on the internet, I came across Objection.js, which offers way more consistency than Bookshelf.js, but in my opinion, it simply offers too many features compared to my needs.My goal was to create a lightweight and scalable ORM with as few lines of code as possible. Today, I proudly present the takeover of the "knex-orm" package package on NPM, which is basically a wrapper around the pure functionality of Knex.Please give me feedback and suggestions for the project, as I am very passionate about it.

Submitted April 13, 2016 at 02:54PM by kripod

Where do you guys host your node apps?

I'm looking for a place to host an API. My first thought was NodeJitsu, but it's not accepting new customers. =s I have lots of experience with Azure, but I think Azure and Amazon end up been the most expensive alternative (and I'm not sure they are the best ones for Node.js). What about Heroku or Appfog? Are there any other alternatives that I'm missing?

Submitted April 13, 2016 at 10:45AM by voidnexx

Check if a given value is empty in JS extending his "truthy" and "falsy" nature

http://ift.tt/1qHqY19

Submitted April 13, 2016 at 09:53AM by jmoctam

Integrating js Gantt Chart with Node.js using REST API and MySQL

http://ift.tt/1S9uOcj

Submitted April 13, 2016 at 08:31AM by Mary_js

Tuesday 12 April 2016

stupid question, but I couldn't find an answer...how should you handle "multi-threaded"ness in Node

I know most are going to say async-call backs, but I'm looking for a more specific scenario which im not sure if it will work.So here is my understanding in JS/Node/Express.Since JS is a single-threaded application, we are to avoid blocking logicfor(i = 0; i < 1 MILLION; i++) would probably be frowned upon.Suppose our Express API looks something like this:api.(/getusers, function(req,res) { //make some async db call, 5 secs users = db.get(); //sort users, takes 10 secs for(i = 0; i < users.length; i++) //do some other non-trivial things 3 secs //make dinner? 2 secs return users at some point?; } And we have the scenario, where 2 users (A/B) call /getusers seconds from each other.my understanding with JS, is that A will wait 20 secs for his response, and user B will wait (20 , for A to be done) + 20 for his response.coming from a Java background, the above would be some what easy. just multi-thread the function blocks so that the 1M user for loop wont block your whole app. and A/B would be able to get their data independent of each other.but how would you handle large for loops and what not in JS/Express apps?How does a callback save the day in this hypothetical scenario?

Submitted April 13, 2016 at 03:36AM by T-rex_with_a_gun

Could someone explain to me how multiple sessions work in Node?

I'm brand new to Node, trying to understand how multiple users could ever use a node server simultaneously.Suppose I have some processing stream "parseAndHandle" which is part of my controller. Every time a client sends a request I want to stream it through parseAndHandle.I could do something like:server = http.createServer(function(req, res) { if (req.method === "POST") { return req.pipe(parseAndHandle).pipe(res); } }); server.listen(process.argv[2]); which should work OK, assuming that I only have one user at a time. But if Joe logs on, sends a request, and Mike logs on and sends another before Joe's has finished returning, how can I be sure that Joe won't get Mike's response?I guess it comes down to my understanding of what a stream is. When information is passed through parseAndHandle, is it all handled by a single object named parseAndHandle reading every chunk of data passed to it by anything which is piping into it, or are instances of parseAndHandle created each time on the fly.What's going on under the hood?Any resources appreciated, perhaps I'm missing something fundamental here. I greatly appreciate all advice!

Submitted April 12, 2016 at 11:48PM by Yamochao

Add .promise() to Function.prototype to convert any callback-taking function to a promise-returning one. What could possibly go wrong?

http://ift.tt/1T2naR9

Submitted April 12, 2016 at 11:27PM by bitmess

User Login with node

Hey all, I'm using express & socketio and i want to add user logins to my app. From a bit of reading it seems doing logins via sockets is not very documented, or maybe not possible in the usual way. Can someone point me in the right direction and if not, the most up to date/well-known user auth that people are using?Thanks!

Submitted April 12, 2016 at 09:52PM by NukeMeNow

95% CPU with select/epoll_wait in idle loop

I'm writing an MQTT client for an embedded device. It works fine for publishing but when I need to do a non-blocking check for incoming messages the CPU usage goes through the roof.I'm putting the select/epoll_wait in the idle loop as has been shown in some of the addon demos that I've read, but its clearly either: blocking the main loop if the timeout is too long (as the speed that node runs at drops to a crawl, or burning all the processor cycles).Where am I going wrong?

Submitted April 12, 2016 at 09:31PM by MrPhatBob

Producing a composite pipe or a "pipeline"

I have several streams that I would like to connect with pipesnew compositeStream([A,B,C])I'd like to return a single stream S in which D.pipe S.pipe E will pipe the output of D through A, B and C, then out through E.Is there a simple way to do this?A.pipe B.pipe C does not work, because it returns only the destination stream. I want a new stream with an entrance at AI realize that pi.pipeline accomplishes this, but I guess I'm wondering if there's some way I can comfortably chain calls, like A.pipeline(B.pipeline(C));

Submitted April 12, 2016 at 08:52PM by Yamochao

Live Stream! server-side programming with node + p5 - He's awesome!

https://youtu.be/w9X1Hd3l8C0

Submitted April 12, 2016 at 07:56PM by misteritguru

Decided to start using pre-compiled template

Hello everyone! For the last 2h I've been trying to use pre-compiled templates. I use ejs and the ejs-compile module to pre-compile my templates. I now have a javascript file which is supposed to render my webpage but I cannot manage to figure out how to server it afterwards with express. I've tried using app.send, app.sendFile and app.render but they don't seem to work. I am doing all of this wrong ? Does anyone here who uses pre-compiled templates to serve their web pages using express ran into the same issues while starting out ?

Submitted April 12, 2016 at 08:15PM by Lzp_Hiro

Had this conversation with my friend today

http://ift.tt/22s0H2n

Submitted April 12, 2016 at 06:20PM by BooRadleyForever

From Rails to Node.js – observations (X-post /r/rubyonrails)

http://ift.tt/1Xtn4Dy

Submitted April 12, 2016 at 05:48PM by MetalMikey666

How to deploy RESTful APIs using Node, Express 4 and Docker

http://ift.tt/1TPcYh5

Submitted April 12, 2016 at 05:10PM by c66guy

jq2 - extract json data

http://ift.tt/22rKomq

Submitted April 12, 2016 at 04:54PM by mkmoshe

BuiltWithMeteor Weekly # April10th2016

http://ift.tt/23BiBCi

Submitted April 12, 2016 at 04:19PM by bogdancloud

[Beginner Question] Is it possible to host node.js or react.js pages on a wordpress site?

I'm trying to see if a Node.js generated application can be hosted on a WordPress site (c-panel hosting) and does that require a specialty theme?

Submitted April 12, 2016 at 04:30PM by chiefst

Experiences with Koa v2?

Has anyone migrated to Koa v2? If so have you guys had any problems or does it feel relatively safe to start a new project with the async/await-based control flow?

Submitted April 12, 2016 at 03:30PM by maruchanr

Does anyone else try to just stick with plain old Callbacks?

I wonder if I'm alone in this but does anyone else not feel to great about using promises, async, q, bluebird, and similar modules for flow control? Constantly refactoring my own code to make it more testable resulted in me getting very comfortable with just callbacks and NO, my code does not go sideways.I feel like that is kinda a fallacy that only using callbacks results in really nested code. Most my code looks like this : http://ift.tt/1qNlDpm and other files in this project.Basically I feel like I'm missing the point to something, and the more I research about these flow control modules the more I dont understand why people are using them.

Submitted April 12, 2016 at 03:27PM by zayelion

The useful library to simplify your work with Telegram Bot Api

http://ift.tt/1lcVXii

Submitted April 12, 2016 at 03:02PM by nof1000

LiveComment is missing link in the Evolution of the Web

http://ift.tt/1qsyLzP

Submitted April 12, 2016 at 12:24PM by d08ble

Adonis 3.0 dev release

http://ift.tt/1SKO8tY

Submitted April 12, 2016 at 09:20AM by romainlanz

Include JSON file in node

Hi, I try to include my rules.json file in my node script.Here is the snippet: var json = require("rules.json"); console.log(json);The problem is, when I execute the script, the console returns "Cannot find module 'rules.json'"Any idea ? Thanks a lot :)

Submitted April 12, 2016 at 08:54AM by doddoreul

Monday 11 April 2016

Can't seem to POST an add comment request (using 'request')

Hello, trying to send a POST request that adds a comment to an Instagram photo. I have all my cookies set up correctly so I'm logged into Instagram. For some reason it doesn't work at all. Here's my code:var request = require('request'); var j = request.jar(); request = request.defaults({jar:j}); j.setCookie(request.cookie('ds_user_id=REDACTED;sessionid=REDACTED'), 'http://ift.tt/1kwsCwF'); request.post({ url: 'http://ift.tt/1RQnIKV', form: {comment_text: 'This work, taken as a whole, lacks serious literary, artistic, political, or scientific value.'}, }, function(error, response, body) { console.log(body); }); Here's what it looks like in Chrome Developer Tools when I add a commentThe code runs fine without any errors but gives an error page instead of the JSON I expected (also it doesn't post a comment)

Submitted April 12, 2016 at 04:28AM by omgflyingbanana

What do you think of a multi-threaded Node.js? Would you use it? [x/post from /r/javascript]

http://ift.tt/20wU5Az

Submitted April 12, 2016 at 03:36AM by voodooattack

ASync vs Promises

Which do you guys like better? Why? I'm here to soak up the knowledge like a sponge!

Submitted April 12, 2016 at 01:32AM by snahrvar

[Beginner question] - How can I call and return the token from another function?

Hi guys,Sorry but another beginner question here.I have the tokenRefresh function which works and can output the access_token correctly.What I want to do is have other functions call the tokenRequest function to get the latest token.I've tried calling but it doesn't seem to work - can someone please help?var request = require('request'), googleConfig = require('./config/google.json'), brandsConfig = require('./config/brands.json'); requestMe(); function tokenRequest() { var payload = { client_id : googleConfig.client_id, client_secret : googleConfig.client_secret, grant_type : googleConfig.grant_type, content_type : googleConfig.content_type, refresh_token : googleConfig.refresh_token }; var url = "http://ift.tt/IlrJjr"; var options = { method : 'post', muteHttpExceptions : false, body : payload, json : true, url : url }; request.post(url, { form: payload }, function(error, response, body) { var parsed = JSON.parse(body); var access_token = parsed.access_token; //console.log(access_token) return(access_token); }); } function requestMe(){ var access_token = tokenRequest(); console.log(access_token); }

Submitted April 11, 2016 at 10:22PM by turtleattacks

Confused about location of require() modules

HiI'm a complete node.js beginner, so please excuse the noob question. I'm trying to go through and understand the code for Kyoku line by line. It's a super simple electron app that displays the current iTunes song title in the OSX menu bar.Where I've had problems is with understanding the require('module'); thing. I get that require() loads code from an external file, but in this case, i don't understand where this file is located. app.js has require statements for the modules 'app', 'menu', 'tray', 'browser-window', 'playback' and 'user-home', but package.json only mentions dependencies for 'playback'and 'user-home'. The other modules are nowhere to be found in the source code (at least for me). Where does node get them from/How can the app use their code? Are they all "core modules"? Or are they accessed through npmjs.com?Any help or links explaining this would be much appreciated. Thank you!

Submitted April 11, 2016 at 09:45PM by cUk6yij5yaC1daC0Ic0f

Optimizations tricks in V8

http://ift.tt/1VOa5xk

Submitted April 11, 2016 at 09:00PM by ghaiklor

How can I make writes to a stream separate 'data' events?

I'm piping output from one file into the input of another. How can I control how the buffers are delimited? I want to ensure that separate 'data' events are triggered on the receiving end's input stream.In outputting.coffee I have:q = require 'q' q.fcall process.stdout.write('1,2', 'utf8') .then process.stdout.write('3,4', 'utf8') In receiving.coffee I have:process.stdin.on 'data', (data)-> console.log "A single chunk: " + data Then I pipe them together in the commandline, with coffee outputting.coffee | coffee receiving.coffeeHowever, as output I get A single chunk: 1,23,4How can I make sure these writes are separate data events?

Submitted April 11, 2016 at 04:55PM by Yamochao

Raw string versus variable comparison (==) efficiency question

I have a node module which does some string comparison. I.e "if (thing == 'string')...". There are several instances of similar comparisons using predefined strings which do not change, and if so, all instances change respectively.Let's say that i store the strings in an object called "MY_CONST", and instead of the above, I do: "if (thing == MY_CONST.string)..."Is there a significant performance penalty from the dereferencing of the value in MY_CONST? Any performance penalty whatsoever? I'm just curious because MY_CONST isn't used outside of the module (a single file), but storing the strings in a variable makes the operation far more sane.

Submitted April 11, 2016 at 03:07PM by SomeRandomBuddy

password protect section of site?

I would like to password protect just a section of my site with node(using express). Whats the best approach to do this? I would like the home page of my site to be public, but a link that will take you to a page that asks for a password, and only users that enter the correct password will be able to access that section of the site. I don't care about adding login names for now.

Submitted April 11, 2016 at 10:33AM by bangsauce

Ready to ride the web? Try QuorraJS NodeJS MVC framework, currently in beta.

https://quorrajs.org

Submitted April 11, 2016 at 09:33AM by harishanchu

Sunday 10 April 2016

Trying to understand Bcrypt code example

I'm going through some code in the 'Express in Action' book and I'm trying to figure out why the progressCallback argument is used instead of the regular callback argument in this piece of code. noop is a no operation function. It's on page 128 for those with the book.bcrypt.genSalt(SALT_FACTOR, function(err, salt) { if (err) { return done(err) } bcrypt.hash(user.password, salt, noop, function(err, hashedPassword) { if (err) { return done(err) } user.password = hashedPassword done() }) }) })

Submitted April 11, 2016 at 04:21AM by audiodev

help

hi , everyone is nodejs is good for a qrcode / url shortner and why ? if I want to use "full potential" of nodejs what web application do you suggest ?thanks

Submitted April 10, 2016 at 11:58PM by temp1293

What's the best way to save documents like pdf and images?

I'm pretty new to Node / Mongo and I would like to know how to save data other than just json documents. I've heard something about saving the data with amazon web services and then save links in the mongo database. Is that what I should do? If so are there any tutorials on how to do this? I've never used AWS before.

Submitted April 10, 2016 at 03:04PM by ilikepoopbrowines

How V8 optimises JavaScript code?

http://ift.tt/1URY0bs

Submitted April 10, 2016 at 07:55AM by ghaiklor

Saturday 9 April 2016

free easy api for storing data temporarily?

I have a need to collect some basic information from potential users.I was going to use Google spreadsheets api but I don't want to bother with the hassle of creating a new Google account (this is a privacy related app and I don't want my real identity tied to it).Is there anything out there that is simple that has a javascript api?

Submitted April 10, 2016 at 06:36AM by xintox5

Does the "pg" module prevent sql injection?

Hey guys,I am using the "pg" module to interact with postgresql. I am wondering if using this module properly (with prepared statements) completely eliminates the chance of an sql injection occurring. I have recently read this post: http://ift.tt/1MmJLZy (not sure what db module they were using) so i'm scared that my sites are prone to sql injection.All my sql statements are prepared statements e.g.: INSERT INTO items(text, complete) values($1, $2) but I'm still worried if there is any change of a sql injection (or any other type of vulnerability )Any help would be greatly appreciated.

Submitted April 10, 2016 at 01:34AM by mre12345

Readable, Writable and Transformable Streams

http://ift.tt/1NhdQEt

Submitted April 09, 2016 at 11:14PM by jstuartmill

[Question] Is NodeJS really interpreted?

Better questionIf NodeJS is interpreted and not compiled, then why do I have to restart the server after every change?Let's say I'm using Express, why can't I modify a method and simply reload the URL like PHP or Perl? Why do I have to keep restarting the server all the time?

Submitted April 09, 2016 at 07:45PM by webdevop

Nodejs took too long to respond

http://ift.tt/1SGlwlr

Submitted April 09, 2016 at 03:58PM by kierancrown

Doing a paper on Node.js and Socket.io performance

What things I should consider when testing the performance of chatroom application while I gradually add " fake " users sending different sized data? Where I could find information/technologies behind Socket.io and Node.js? What things I should consider analyzing the performance data?

Submitted April 09, 2016 at 02:25PM by pioneersystem

µWebSockets: Highly scalable WebSocket server library, now available for Node.js

http://ift.tt/1MO7CMc

Submitted April 09, 2016 at 01:41PM by alexhultman

Express.js vs Phoenix Framework | ab load test

https://www.youtube.com/watch?v=J6uIqqIdBWo

Submitted April 09, 2016 at 01:08PM by indatawetrust

Wondering how you guys determine a file exists or not after the fs.exists is deprecated.

I wrote a library to do this. (http://ift.tt/1YkTxfc). But I am wondering how you guys do this.

Submitted April 09, 2016 at 01:11PM by m31271n

Can NodeJS benefit from multi-threaded libraries?

I've recently come across what I think is a very interesting HTML5 library written in C with support for multi-threading (http://ift.tt/1O4k5dC). As far as I am aware NodeJS is single-threaded in nature. That being the case, would it be possible to create a NodeJS module from the aforementioned c library using node-gyp to take advantage of low-level multi-threaded API?

Submitted April 09, 2016 at 11:39AM by pedrocls

Friday 8 April 2016

Looking for recent nodejs talks/explanations

I really enjoyed this talk by Ryan Dahl especially because he speak how node works under the hood and the differences with other web servers but I think it's quite outdated so I'm looking for more recent similar video. What do you suggest?PS: I found this video very funny :D

Submitted April 08, 2016 at 08:58PM by muccapazza

Event Emitters in NodeJs

http://ift.tt/1RVNB8O

Submitted April 08, 2016 at 07:30PM by Fady-Mak

Advice for Beginner NodeJS programmer?

Hi guys, I'm just getting into Node as of the last month and have made some great progress. But there is so much to learn and so much to explore. I'm curious if you guys could share any articles or concepts or general advice that really helped you along the way. Thanks!

Submitted April 08, 2016 at 06:48PM by snahrvar

Do you know any opensource alternative to hook.io or webhooks.io?

Pardon me for asking this as i don't know which sub to ask. I am looking for an opensource webhook relay that has a web interface like the ones i mentioned.Hook.io is opensource but i have problem making it work and i think it's a bit bloated. Is there a simpler one? Or any alternatives would do.

Submitted April 08, 2016 at 02:15PM by abugee1029

How to use global packages on AWS Elastic Beanstalk?

Hey guys! I don't know how to setup node on beanstalk to use global packages. I'm using default node.js setup from AWS. Can you help me please?

Submitted April 08, 2016 at 11:54AM by yoihito

Javascript, Ecmascript 2015 survey

Hello World! Me and my classmate are working with our bachelor thesis and are wondering if you have five minutes to answer our survey. The survey is about Javascript’s newest release Ecmascript 2015. The survey is a comparison between Ecmascript 5 and Ecmascript 2015 and no previous knowledge is required.http://ift.tt/1RIfS67 in advance

Submitted April 08, 2016 at 11:24AM by ES2015VSES5

inversify@2.0.0-beta.1 - Contextual binding support

http://ift.tt/1Wh9tkb

Submitted April 08, 2016 at 10:24AM by ower89

Question's about Binary vs Text Websockets (BSON vs JSON)

I am curious if I should use BSON or regular JSON to transfer data across Websockets. I have heard using binary is faster because the websocket frame doesn't have to "convert" the data to a "string" if you will. (Not entirely sure about that). But, if you inspect the websocket frames of a game called treasure arena which uses massive JSON communication between client / server; I feel like going binary is negligible.With that said, what are the pro's and con's of binary vs text websockets? Obviously on binary it's harder to peek at the data (although, Wireshark takes care of that). Just not sure if it's worth it as I havn't seen any benchmarks that have incentivized me to binary.Thanks for reading!

Submitted April 08, 2016 at 09:49AM by BillOReillyYUPokeMe

Thursday 7 April 2016

Why NodeJS is so fast?

http://ift.tt/1PxURLx

Submitted April 08, 2016 at 06:35AM by ghaiklor

modhelp: get syntax-highlighted module READMEs in terminal

http://ift.tt/1zmQ0ne

Submitted April 08, 2016 at 02:52AM by runvnc

yo docbase - turn markdown projects into beautiful sites

http://ift.tt/1W8MW95

Submitted April 07, 2016 at 11:51PM by sidi09

Top 10 Node.js articles

http://ift.tt/1S0pU1h

Submitted April 07, 2016 at 11:27PM by mightbbest

Learning resources for Koa js

Trying to get into Koa js atm, most tutorials are very basic and not in depth. They're all aimed at people who have a thorough understanding of other node server frameworks. Anyone know any good learning resources for Koa js? Looking through documentation can be quite hard for a beginner/intermediate.

Submitted April 07, 2016 at 10:48PM by fantapeach1

Should we be using NPM for front-end modules?

Hey guys,So I'm a Node Noob, and this is an interesting subject that I came across today. Should I be incorporating my various frontend JS plugins the old fashioned way (download, bring into folder, and call in script tag), or should I be using NPM somehow? What is the best practice?

Submitted April 07, 2016 at 09:25PM by snahrvar

NodeConf Argentina 2016

http://ift.tt/23fMQ59

Submitted April 07, 2016 at 08:35PM by a0viedo

How passport-local-mongoose actually works ?

Hi fellas, node noobie here.i'm trying to authenticate a user right after registration but my code somehow doesn't work...code & explaination hereCheers.

Submitted April 07, 2016 at 07:05PM by SuspiciousTaco

building apis with loopback and strongloop

http://ift.tt/1qwmvyi

Submitted April 07, 2016 at 06:17PM by tony_sf

NodeJS on godaddy webhosting cpanel with cgi-node not working, looking for alternative.

Hello everyone, I want to use NodeJS on a linux cpanel server. This didnt work: http://ift.tt/1q9BCNv so I am wondering if anyone knew another way to achieve this.

Submitted April 07, 2016 at 05:42PM by timgfx

How do I avoid this mess?

First of all, is this the best subreddit for a technical question? I'm trying to clean up this code and make it less of a Russian doll situation. Any advice would be appreciated!posts: function (connection, options){ //Find out what topic we are at connection.query("SELECT * FROM topic WHERE url = '" + options.parameters.topicTitle + "'", function (err, topicRows, fields) { if (err) throw err; //Find out what subcategory this is connection.query("SELECT * FROM `subcategory` WHERE `url` = '" + options.parameters.subcategoryTitle + "'", function (err, subcategoryRows) { if (err) throw err; //find out what the category title is connection.query("SELECT * FROM `category` WHERE `url` = '" + options.parameters.categoryTitle + "'", function (err, categoryRows) { if (err) throw err; //get all the appropriate posts connection.query("SELECT * FROM `post` WHERE `topic_fid` = '" + topicRows[0].topic_id + "'", function (err, postRows) { options.res.render('postList', { category: categoryRows[0].title, categoryLink: categoryRows[0].url, subcategory: subcategoryRows[0].title, subcategoryLink: subcategoryRows[0].url, topic: topicRows[0].title, topicLink: topicRows[0].url, posts: postRows, }); }); }); }); }); },

Submitted April 07, 2016 at 04:44PM by snahrvar

Proxy and Anonymizer Tool for Mac and Windows on NodeJS/NWJS

http://ift.tt/1RRtpF5

Submitted April 07, 2016 at 02:21PM by orgaralf

Dependency Inversion in JavaScript with contextual binding support powered by TypeScript

http://ift.tt/1WeGvkY

Submitted April 07, 2016 at 01:02PM by ower89

Learn JavaScript Series: 4 Great Resources to Learn NodeJS

http://ift.tt/1S4jMYX

Submitted April 07, 2016 at 12:07PM by bencso

Realtime Node.js Deployments with Now

https://zeit.co/now#

Submitted April 07, 2016 at 09:05AM by amzans

IOT new Buzz in Web Development.. Must read!!

http://ift.tt/209EZ3C

Submitted April 07, 2016 at 08:09AM by 1-2-3-4-5-6--

Wednesday 6 April 2016

High-performant API for cursor in terminal (just look at the demo)

http://ift.tt/1oE3NTM

Submitted April 07, 2016 at 07:01AM by ghaiklor

Express-Session. Sessions are never saved. Help!

Go easy on me friends. I'm a mobile developer venturing into the world of web dev. I'm learning about authentication. I want to skip passport until I understand what's going on better. So I'm using express-session with express-mysql-session as its store. At the start of my app I initiate my session as such: app.use(session({ genid: function(req) { return genuuid(function(err, uuid){ return uuid; });// use UUIDs for session IDs }, key: 'session_cookie_name', secret: 'session_cookie_secret', store: sessionStore, resave: true, saveUninitialized: true }));  Everytime my user loads the home page I check if a session.name exists, if it doesn't I set it. However each time the user refreshes the page, it looks like the session.name is null again. Why? Am I using express-session correctly?

Submitted April 07, 2016 at 04:54AM by createsomethingbig

use ~ in require and import calls

http://ift.tt/25M9Vv4

Submitted April 07, 2016 at 02:42AM by mkmoshe

How is the performance for MMORPG server by node.js?

Lately I've looking at node.js and thinking it is quite useful for online game server. so I am considering node.js server as my tiny online game server in the future. (I have several experiences in making online game server)But anyone has experienced as a MMORPG server earlier with node.js?Especially I wonder about its scalability and the maximum user per a machine.

Submitted April 07, 2016 at 02:35AM by utherkim

Passport-local. I can register a user, but when I try to log in it throws an error.

Hello. I am trying to set up my registration and login with Passport and I made a working copy of this tutorial http://ift.tt/1RPJ0F0 when I tried to integrate it to my project I am getting some odd results.On the linesapp.post('/login', passport.authenticate('local-login', { successRedirect : '/profile', // redirect to the secure profile section failureRedirect : '/login', // redirect back to the signup page if there is an error failureFlash : true // allow flash messages })); none of my flash messages are triggered the only feedback I get is the failureRedirect is the only thing that is called. I just went over the tutorial and my working copy cross referencing my code that isn't working, and I cant see for the life of me what would I can do to solve this.Instead of linking all my code, its the same code as the link above. The files of importants are app/routes config/passport.jsI have all the packages installed.Maybe some help on how to properly format errors? In the code there are if error { return done(err); }but I am unsure how to retrieve that data to see what its catching.So like I said, all the info I am getting right now is everything is working except when I try to login, I get the failureRedirect.here are my files if needed to see server.js config/passport.js app/routes.kjsThanks for any help

Submitted April 07, 2016 at 01:36AM by clandest

Noob with a problem with socket cookie

Hi there,I've only recently started using node and been doing only locally recently had to put my server running remotly on a computer but for some reason its breaking.The setup: the remote server is a ubuntu i have node, express, passport (with google strategy), socket.iowhat happening, well after google redirects me back, passport does its magic and setups a cookie on the client side called connect.sid with a number for the session which is also stored on memory on the server side. Both the server and the client side match. Since im also using sockets, im using the socket.request.headers.cookie to check if its on the store, if it is then i can find out who is the user and use that user value for db magic. On the localhost this works, when on the server http://ift.tt/1TCNGTo u can see the socket.request.headers.cookie doesnt return a connect.sid value but i have it both on the client side and on the server store (the last print)i have some code snippets here http://ift.tt/1oDgGgW

Submitted April 07, 2016 at 12:09AM by GeckoNinja