Wednesday 4 May 2016

How are devs currently working with es2015 on the server?

This might be considered a best practices (or current practices question due to how fast this ecosystem moves).I've currently got a setup where I'm using gulp/babel to transpile my js, and nodemon running on the output.Is this too much? Is there a better way?Why am I doing this? I want to use es2015 for my server code.

Submitted May 04, 2016 at 10:04PM by neonlibra

Job opportunity for experienced full stack JS dev (DC area)

Hi /r/node, my group is hiring for a full stack JS dev to work on a new project. We're mainly a data science group, but will be overseeing the development of a prototype web app, and are looking for lead web developer. There may be room for up to 2 people, so a complimentary pair of "front end leaning" and "back end leaning" could work, but we're really looking for people with significant experience doing both.This is an on-site position in the DC area (northern VA)Reasons it's a good place to work:large, stable company; diverse workforcecompetent, friendly, respectful colleaguesstart from a nice empty repo, not a big legacy code hairballbrand new apple hardware for youAbout you:experienced developer. this isn't a good fit for someone who's fresh off of just building their first to-do list app (no shame in being that person! this just isn't the right role for somebody like that)competent, friendly, respectfulgreat communicatorPM for full job description if you're interested and think you'd be a good fit. happy to answer any questions

Submitted May 04, 2016 at 09:01PM by arvi1000

Want to see all the modules node is requiring?

Just put this at the beginning of your files. ``` const m = require('module') const originalLoader = m._loadm._load = function (request, parent, isMain) { console.log('_load', request) return originalLoader(request, parent, isMain) } ``` I was a bit surprised how easy it is to achieve.

Submitted May 04, 2016 at 08:50PM by Capaj

Best practice for uploading delimitated files and insert ing into DB?

I'm having trouble putting this one together. Its easy to get the file upload working however I'm a little uncertain on the parse to DB. These files are going to be relatively small so memory should not be a concern. There are also tons of csv-parser type packages out there. I'd like one where you can choose which columns and it converts to JSON. Any suggestions or examples?Thanks!!The files will be in the following format:Monitoring Data ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Time |Server Name |Act. WPs|Dia.WPs|RFC WPs|CPU Usr|CPU Sys|CPU Idle| Ava.|Paging in|Paging out| Free Mem.|EM alloc.|EM attach.|Em global|Heap Memor|Pri.|Paging Mem|Roll Mem|Dia.|Upd.|Enq.|Logins|Sessions| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 00:00:08|sappcp0_CP0_00 | 2 | 1 | 32 | 2 | 3 | 95 |5.00 | 0 | 0 | 2,827,708 | 1,892 | 1,784 | 375,052 | 0 | 0 | 54 | 1,127 | 0 | 0 | 0 | 8 | 8 | | 00:00:08|sapvcr01_CP0_00| 1 | 1 | 32 | 0 | 0 | 100 |4.00 | 0 | 0 |11,213,884 | 2,792 | 2,360 | 378,760 | 0 | 0 | 734 | 3,579 | 0 | 0 | 0 | 32 | 32 | | 00:00:08|sapvcr02_CP0_00| 2 | 1 | 32 | 0 | 0 | 100 |4.00 | 0 | 0 |47,230,256 | 2,648 | 2,364 | 378,300 | 0 | 0 | 696 | 3,981 | 0 | 0 | 0 | 36 | 36 |

Submitted May 04, 2016 at 03:57PM by dangerzone2

Am An Android developer, is it worth it to learn Node.js?

Am an Android Developer , I have old experience in PHP, .net, and javascript. My employer is asking me to learn Node.js to develop a chat system customized for our needs, I feel I can see the project through but I heard a lot of negative comments about Node.js from experienced web developers.Am excited to learn new technologies, I know how much trouble might cause me , but as long as I can build something that works, I have no problem . We will integrate the project with a .Net website we already have, we need the chats to be synced across all devices and web , we currently use quickblox, but our requirements are causing us to use it in a stupid inefficient way and its crashing a lot.I need Advice, should I go through that path (Node.js) ? or should I just not get involved?

Submitted May 04, 2016 at 03:28PM by yehyatt

Studio.js - Micro-services framework for Node.js

http://ift.tt/1rDlKUV

Submitted May 04, 2016 at 01:28PM by oliveiraerich

Framework for developing desktop applications with Electron

http://ift.tt/26SpSQU

Submitted May 04, 2016 at 10:02AM by a1chapone

Tuesday 3 May 2016

Hello r/node, I'm in severe need of help for a project of mine. Plz help.

I'm new here, so forgive me if I seem like a total outsider.I'm an iOS developer, and I'm making my biggest project ever right now which is really exciting for me! I'm getting great traction with the app I'm building, and people really seem to like it. The only problem is, I'm an iOS developer with very little server side experience. I'm running my app off of Heroku with Node.js and Socket.io. The app needs real time, and I know that scalability will soon become an issue.I've been researching a lot about using multi-core systems, concurrency, and what I believe is a potential solution: Clusters. But I have absolutely no idea how to go about implementing this. I guess what I'm really looking for is someone to take some time and explain things to me, and walk me through how they would go about solving my particular problem. If I can get a solution running with your guidance, the good thing is my app has funding, and I can compensate you for some time (I hope that isn't frowned upon in this sub??).If anyone is willing to help, I'd be super grateful. Especially if you've worked with Socket.io! Please let me know, I'm stressing out trying to learn it all so quickly.

Submitted May 04, 2016 at 05:32AM by mil_kid

Proper ES2015 Middleware Class Instantiation?

Finaly trying out ES2015 and I am having a hard time using it in a similar manner to my existing revealing module pattern 'classes'. It seems like best practice is to use the new class syntax for everything but it seems much more restrictive than revealing module pattern classes. My problems right now are in relation to trying to use ES2015 classes as Express middleware. I can only seem to pass arguments to a specific class method which then has an undefined reference to this so it cannot call any other internal class methods. Ideally I want to be able to just call 'app.use(Middleware)' and have the constructor call method1 which uses req, res, next arguments and can call other internal methods like method2 etc. I feel like I am missing something very basic here... ( running Node v5.11 without transpiling )ES2015 Middleware.js:class Middleware { constructor(req, res, next) { console.log(arguments); } method1(req, res, next) { this.method2('test'); } method2(msg) { console.log(msg); } } module.exports = new Middleware(); Revaling Module Pattern Middleware.js:var Middleware = (function(){ var method1 = function(req, res, next) { this.method2('test'); }; var method2 = function(msg) { console.log(msg); }; return { method1: method1 }; })(); module.exports = Middleware; Express:ex 1 let Middleware = require('./Middleware'); app.use(Middleware.method1) // this == undefined, unable to reference any other Class methods ex 2 ( attempting constructor use ) let Middleware = require('./Middleware'); app.use(Middleware) // no req, res, next in constructor

Submitted May 04, 2016 at 05:20AM by qweqweasdqweasdqwe

Learning Node JS from a PHP background?

So I'm over on the openshift platform ( http://ift.tt/11iDe6x ) normally I'm 99% PHP focused but the new Microsoft bot API says use C# or Node JS. So I opted to let openshift do my hosting and use node. 5.6 was easy enough to install and npm. And... I can run things aside from the basic server they provide. Binding things to ports and IP's is a little different then what I'm used to with PHP (I mean the DB's are pretty easy to set ports and IPs for it's pretty much automatic)Where I'm confused is how to use something like this telegram bot (or other production code). Looking over the code it doesn't seem to bind to a port. So what do I tell telegram to set the webhook to? Is openshift a limiting factor in what I'm capable of, as far as PHP it's been the most open platform without doubt.I'm doing something wrong... normally I have a location like http://webhost/script.php but with node I've just got .js files that use a port and IP... sometimes a directory which is kinda strange to me. Perhaps I need to expose those .js files in some way or bind a directory for things to use?

Submitted May 04, 2016 at 03:26AM by edmazing

NodeJS 6.0 quick performance test

http://ift.tt/1TknGau

Submitted May 04, 2016 at 03:33AM by CmdrKeen4

How can I control this for loop?

What is the best service/ practise to manage service to port allocation?

My current setup is as such:I have one nginx server that acts as an entry point to all micro services. Then I have multiple servers which are running node.js (express.js) services controlled using PM2.This setup on its own does not scale: I have 50+ services. Every time when I need to allocate a port to a new service I grep the contents of the nginx configuration to make sure that none of the existing services are using that port. If they don't, I start a new service using that port.And vice-versa – if I need to find a specific service, I look into nginx configuration, find the IP and port of the service.Now a simple improvement would be to use Google Sheets to keep track of these mappings. But thats not ideal either (it is easy to get out of sync).Is there an established convention/ tools to manage service to port allocation?

Submitted May 03, 2016 at 11:01PM by kAf4mGoIgCKt

Amazon EC2 vs Digital Ocean

What do you guys prefer for publishing your NodeJS applications? And why?

Submitted May 03, 2016 at 09:53PM by snahrvar

Dear /r/node: Let's build the best Node.js API Framework, together. Need your help!

Hey again r/node :).If you haven't heard of Nodal, please check it out. I'm looking at gathering as much feedback as possible as to what Nodal needs to be a viable production-ready framework. Already had some AMAZING feedback from the community, and some really helpful people have jumped on phone calls.Things we know we need; better documentation. Asynchronous validations. PostGIS support. We've noted these changes. My questions to you are what tools and things do you need to use Nodal in production. We're planning a roadmap to 1.0, and I want to make sure the community stays involved. I can't promise we'll tackle everything listed here. We just want a good idea of problems we can solve out of the box vs. problems we can provide directed solutions for.Look for a lot more material about Nodal in the coming weeks, and thanks so much for your support!

Submitted May 03, 2016 at 09:26PM by keithwhor

Is it true that by re-compiling nodejs with different options will obtain better performances? [CPU/Cores]

Recently, I was running two similar piece of code, to obtain the same result: One was more complex (sorting an array, extracting first and last element), the other one less complex (using Math.max and Math.min to extract the values). I have noticed that on my Mac, the "complex" solutions runs faster than the simple solution. Instead the version for my RaspberryPi, was taking less time to run the less complex solution and more time for the other one.I am guessing that the numbers of cores affecting some callbacks or methods like Array.map or Array.forEach... Is it true then, that by re-compiling nodes from the sources, but with different options, I may obtain similar performances? Would that be possible?

Submitted May 03, 2016 at 09:30PM by koalalorenzo

Can anyone recommend a good tutorial for integrating EJS with Koa?

I am just not understanding the docs at koa-ejs. Thanks!

Submitted May 03, 2016 at 05:30PM by BackPacker777

Is there any Node tutorial like the tutorial for Flask?

On the Flask site, they have an example project and walk the user through how to make it. Is there any sort of similar type of tutorial for Node.js?

Submitted May 03, 2016 at 03:47PM by naliuj2525

Is Sequelize the most advanced ORM for nodeJs?

I'm looking for the current best, most active, scalable SQL ORM for NodeJs. I currently see Sequelize as the winning contender against bookshelf and a few others. Please discuss! :)

Submitted May 03, 2016 at 03:22PM by ThomasSmWatson

After a year of using NodeJS in production

http://ift.tt/1Nimit1

Submitted May 03, 2016 at 02:07PM by kostarelo

Debugging Node.js applications using core dumps

http://ift.tt/1SJiwJl

Submitted May 03, 2016 at 02:24PM by Kuytu

Promises Inside Promises...

Hey guys, I'm kind of stuck if I am doing this correctly.Basically, this is my redis setup: http://ift.tt/1QQeVDy have 3 keys labeled with games:*.My code: redis.keys('games:*').then(function(data){ return Promise.map(data, (gamename) => { return redis.get(gamename); }) }).then(function(data){ console.log(data) }); Which outputs: [ 'A MUFFIN!', 'A MUFFIN!', 'A MUFFIN!' ]Which is correct. But.. is this the correct way to do this? I love how bluebird makes it so much easier and I love the control flow. But I feel like I am doing something wrong. I don't know how to explain it.Does my final then always perform after the last redis.get call inside the`map'? Always? Or can some io bound / redis lag happen and return unwanted results? I just need to grasp my head around this async stuff, it feels like magic.

Submitted May 03, 2016 at 10:22AM by BillOReillyYUPokeMe

Sunday 1 May 2016

jsx code coverage with webpack

I have a project that I'm switching the UI from angular to react. I have a nice build system setup with istanbul/gulp/protractor that gives me combined code coverage for the backend and the front end. I'm looking to re-create the same thing using webpack. I'd like to start the webpack actions from within gulp.I have the basic bundling and html injection working fine. (Bundle is created and the appropriate link is injected into my index.html). I've found a bunch of sample karma.conf files, but I'm having a hard time grokking what they're doing. (I'm sure I can cut and paste and get something working, but I really kinda hate doing that)Any pointers? how do the pieces fit together? I'd like to have an lcov file generated that I can combine with the other (non browser based) tests.Doesn't look like adding sauce labs support would be that hard once I get the overall build running.

Submitted May 02, 2016 at 03:44AM by skarfacegc

babel preset madness - difficulties setting up with node 6?

My team put in babel to our node project about a year ago. Now node 6 is out with 98% es6 support and I'd like to make sure babel isn't doing anything but handing node modules. I started to look into node presets and they seemed unnecessarily complicated. Shouldn't the configuration be as simple as stating the inclusion of one plugin for node modules? Maybe it is and I missed it?Any help is appreciated!

Submitted May 02, 2016 at 02:42AM by get2workUslacker

Bringing the Stack Overflow mission and mindset up to date with contemporary programming practices

http://ift.tt/1SUHT9S

Submitted May 02, 2016 at 01:57AM by runvnc

Idea for a torrent-like(?) marketplace.

After OpenBazaar launched I was kinda disappointed at the low level of anonymity for the stores. I was thinking about it this weekend playing around with node.js.My idea is that node.js servers would talk to each other over http (.com/.*/.onion) with json, visible to any browser. Users accessing the Store-fronts would use a browser and node.js app or a service that did the parsing for them.Here is the flowchart I used http://ift.tt/1W1mKyW . So far I got the nodes talking, did some "proof of work" for the /join and tried a Store-front structure (all spaghetti code with express, node-rsa).Here is the basic outline:* Server shares a list of node-addresses, and if willing Store-fronts.* Never send anything other then a /join command with home-address(and if it has information more up to date than the contacted node). It's up to the contacted server to sync.* Possible to run without writing to disk.Positive:* Almost impossible to find the source of the Store-fronts as every server has the same information.* Very cheap to host. Vps with node.js.* Works on clearnet and tor.* Servers could get payed to host certain stores and provide a fast lane. Many micro payments possibilities.* Someone could set up a server that displays the Store-fronts without managing the content.Negative:* Could take very long time to find an up to date store.* No communication (possible to share email, skype, bitmessage instead).* Once online the owner of the store has zero control over the information shared. Can only update and hope the servers pick it up.* No images(possible to use base64 images).* Buyer can't tell if the seller still out there.* Proof of work could be hard for small clients(pi, vps).Is there a module that does the kind of signaling described for my nodes or any other helpful modules?Thanks for your time.

Submitted May 01, 2016 at 07:29PM by xxmon

Nodejs event loop processing question

Example: just having a hard time putting this into techical language:Say user Bob and James submit a request to join an existing users match to a socket.io server at close to the same time. James is shortly after bob. The mysql server lags for bobs request.If the mysql server goes back to normal speed will james' request be processed first and cause a duplicate opponent for the game in question? Or will bobs request be processed first regardless?

Submitted May 01, 2016 at 07:19PM by Throwawayer75

Controlling the Ableton Push with Node.js

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

Submitted May 01, 2016 at 03:07PM by AAvKK

Why Small Modules Matter

http://ift.tt/1VZgPtn

Submitted May 01, 2016 at 03:06PM by fagnerbrack

When the past meets the future

http://ift.tt/26HdMtO

Submitted May 01, 2016 at 02:42PM by KatamoriHUN

db.collection.find not working

On my project with node and mongodb db.collection.find just not working. In routes.js file there is a function getUser() that tried to find a user by user_id, but finds nothing. I tried to do the same with same parameters on console and everything works fine.How to invoke the error: go to your profile page, create an item and redirect back to the profile page, then refresh it. Because of that a profile.ejs file can't be executed.function getUser(user_id) { var items; User.find({'user.id': user_id}, function(err, users) { if(err) throw err; items = users; return items; }); } app.get('/profile', isLoggedIn, function (req, res) { wasMessageShown(app.locals.answerObj); console.log(req.user); var user; if(req.user.user.id){ user = req.user; } else { user = getUser(req.user.item.user_id); } res.render('profile.ejs', { user: user, messageSuccess: app.locals.answerObj.messageSuccess, messageFailure: app.locals.answerObj.messageFailure }); });

Submitted May 01, 2016 at 12:54PM by GodOfTheMetal

Sqlite3 not working with 6.0.0?

Anybody know any workarounds?

Submitted May 01, 2016 at 10:18AM by devandro