Friday 30 June 2017

node-ahk: Desktop scripting with Node.js and IronAHK

http://ift.tt/2tunELQ

Submitted July 01, 2017 at 07:41AM by laggingreflex

[Question] Anyone headed to Node Summit in SF + meetup?

Hey All! Headed to Node Summit in SF July 25th -27th. Anyone want to meet up for some beer before/after?What talks are you going to see?1st time at the Summit so want to make the most of it...

Submitted July 01, 2017 at 06:48AM by robotixs

[Question] What's the best solution for hosting a node.js site/app?

Hi,I was just wondering what the best solution for hosting a node.js app, as well as the website and static files. I want a VPS like product that can do everything, all on the single machine.I've heard of people using linode for this sort of stuff, but is that the best option?Thanks, and sorry if this is the wrong place to post this.Finley

Submitted July 01, 2017 at 06:24AM by finleydoestech

How to Start Contributing to Node.js

http://ift.tt/2svBIAl

Submitted June 30, 2017 at 11:34PM by _bit

The JavaScript solution for dynamic configuration by Maji.

http://ift.tt/2t9LRo7

Submitted June 30, 2017 at 10:41PM by stevenmiller888

Mongo not grabbing data when POST sent from Axios, but works when sent from Postman

Not sure what is going on here. I sort of hacked around the parameter syntax for axios and did this:axios.post('api/gen-traffic?' + 'param1=' + this.state.param1 + '&param2=' + this.state.param2 ) .then((response) => { console.log('In then') console.log(response) }) .catch((error) => { console.log('In catch') console.log(error) }); And when I send this URL through Postman, everything works fine, but when I send it through Axios and query my Mongo instance using the params, one of them ends up undefined for no reason. However, when I initially post from Postman then do another one right after from Axios, it works. Any guidance? Can post some more code later.

Submitted June 30, 2017 at 07:46PM by tangerto

Introduction to Node.js API Unit Testing with Mocha and Chai

http://ift.tt/2u78Hge

Submitted June 30, 2017 at 06:56PM by pasimako

Can't access req.user on routes

Hey guys,I'm using express / express-session and passport.To skip the obvious causes, I'm using express-session, initializing passport, calling passport.session() and serializing / deserializing before requiring my routes.Somehow, req.user is still undefined on my routes, except it turns up when the browser requests /favicon.ico. Does anyone have some ideas as to why req.user wouldn't be showing up? It's almost like the routes get hit before passport is done deserializing.

Submitted June 30, 2017 at 10:59AM by ajc820

Learn NodeJS With Me (Part 6) - ECMAScript 5 - Object Extensibility

https://www.youtube.com/attribution_link?a=_ETFHdTnMZE&u=%2Fwatch%3Fv%3D_1IiE5lBrF4%26feature%3Dshare

Submitted June 30, 2017 at 11:34AM by grouseydaryl

Node.js Weekly Update - 30 June

http://ift.tt/2tqNPTI

Submitted June 30, 2017 at 09:55AM by hfeeri

Thursday 29 June 2017

Why use express?

I intend to build a web app shortly with angular4 and node with mongodb.I was researching on the MEAN stack and realized I had a dumb question..What's the point of even using express? Why shouldn't I just write the back-end code in node?I realize this is probably a really dumb question, I'm just hoping for a moment of clarity!

Submitted June 29, 2017 at 09:16PM by VidarSeptim

memoryjs: writing to and reading from memory with Node.js

http://ift.tt/2sKsnb3

Submitted June 29, 2017 at 08:20PM by AndroidL

What is the simplest authentication solution for a web app that only requires a single user login?

I'm building a simple web app which only requires a single user to login and use the app.Am I right in thinking that passportjs is still the best solution to this? I don't need a registration page etc. just a login for the sole user.Any advice is welcome.

Submitted June 29, 2017 at 01:54PM by Chiasmata

How to get, use, and close a DB connection using promises

http://ift.tt/2skCTap

Submitted June 29, 2017 at 02:03PM by dmcghan

Node module to create and trigger your own webHooks.

http://ift.tt/2i1BOPB

Submitted June 29, 2017 at 10:40AM by roccomusolino

Getting started with Node.js and Robotics

http://ift.tt/2sk2mk9

Submitted June 29, 2017 at 10:44AM by carolina_sar

base64-async: Non-blocking chunked Base64 encoding

http://ift.tt/2siQNdb

Submitted June 29, 2017 at 10:29AM by dyslexiccoder

Is there an equivalent of getc?

I'm writing a program that's based on a C script, and part of that involves reading (or writing) a file byte-by-byte at different parts of the script.Writing seems simple enough to recreatevar newFile = fs.createWriteStream("createdThingy.txt"); for(var i = 0; i < 256; i++) { newFile.write(Buffer.from([Math.floor(Math.random() * 256)])); } Reading byte-by-byte, on the other hand, is a bit muddier. I was hoping I could do something likevar newFile = fs.openSync("navyseal.txt","r"); var firstThingy = fs.readSync(newFile); var nextThingy = fs.readSync(newFile); for(var i = 0; i < firstThingy; i++) { var anotherByte = fs.readSync(newFile); console.log(anotherByte); } But that doesn't work at all, and despite looking over the docs on fs, I have no idea what I'm doing

Submitted June 29, 2017 at 08:27AM by DoomTay

Node v8.1.3 (Current)

http://ift.tt/2trWZzS

Submitted June 29, 2017 at 08:42AM by dwaxe

I built a cachebuster CLI!!

http://ift.tt/2u1cX0S

Submitted June 29, 2017 at 08:46AM by jcferrans

Yet another node.js framework

https://x2node.com

Submitted June 29, 2017 at 07:58AM by _bncc

Wednesday 28 June 2017

I built a library for working with intervals in node! I would love feedback :)

http://ift.tt/2sTpqoA

Submitted June 29, 2017 at 07:00AM by Xenear2

Bundling and deploying a full-stack Node app to production and why it confuses me

So I've asked around and there seems to be a consensus among developers: it is best practice to build (pack, bundle, compile, whatever you wanna call it) your source code on your local machine, run tests on the built code and then push the built code, and only the built code, to the production server.Trouble is, I can't figure out how to make this happen in a simple automated way. I normally have my dist folder in .gitignore. So let's say I want to deploy to Heroku automatically from Github every time there is a new commit. Right now Heroku would pull the entire project's source code, install all the dependencies, then it would run a build script before it starts the app. That is the opposite of what everyone tells me is best practice.So, here's my question, how can I automatically deploy my already built code to Heroku? Is there a simple, straightforward way to do it? Or must I use a series of 16 obscure git commands? Right now, my way of deploying may not be best practice, but it is easy and straightforward: change some code in VS Code, commit, push the sync button and ... a few minutes later, boom, my Heroku app has been automatically updated through Github. Can I change my workflow to reflect best practices but still keep it simple?

Submitted June 29, 2017 at 05:22AM by Neoflash_1979

Generating graphs server side to output a raster image without any system dependencies.

Hey guys, just wondering if any of you have figured out generating graphs serverside and outputing them as raster images like png/jpg.At the moment I'm using gnuplot, which I install through the package manager on the system, but I'd like to move away from this and be able to run it in environments where the script possibly has no display or even a browser.

Submitted June 29, 2017 at 03:19AM by cruzcontrol56

Is this an insane way to manage dependencies or not?

So I am building a server which has many different modular parts, and it acts as a websocket server, an express server and other things. I have each part of the server in its own module that exports a constructor function likemodule.exports = function(){ }; and then in my main server.js file, I create instances of them like sovar PartOfServer = new Part(); and then certain parts of the server depended on different things so instead of figuring out which part needed which things, and creating the constructor function signature to match, I just did this:var express = require("express"); var app = express(); var config = require("./config"); var server = require("http").Server(app); var io = require("socket.io")(server); var socketServer = require("./app/sockets/socketserver"); var httpserver = require("./httpserver"); var path = require("path"); var util = require("./utility"); var bodyParser = require("body-parser"); var apiRoutes = require("./app/routes/authapi"); var basicRoutes = require("./app/routes/basicroutes"); var cors = require("cors"); var morgan = require("morgan"); var jwt = require("jsonwebtoken"); var UserModel = require("./app/models/user"); var passwordHash = require("password-hash"); var QueueModel = require("./app/models/queue"); var RoomModel = require("./app/models/room"); var mongoose = require("mongoose"); mongoose.connect(config.server.db.URI); var dependencies = { express: express, app: app, config: config, server: server, io: io, socketServer: socketServer, httpserver: httpserver, path: path, util: util, bodyParser: bodyParser, morgan: morgan, cors: cors, apiRoutes: apiRoutes, basicRoutes: basicRoutes, jwt: jwt, passwordHash: passwordHash, mongoose: mongoose }; // ======================= // configuration ========= // ======================= var User = new UserModel(dependencies); var Room = new RoomModel(dependencies); var Queue = new QueueModel(dependencies); var basic = new basicRoutes(dependencies); var auth = new apiRoutes(dependencies); ............ I feel like this might be kind of a weird way to pass around references to dependencies, but so far it has worked and it keeps each "part" cleaner. This also might be completely insane, I'm really not sure as I'm new to node.

Submitted June 29, 2017 at 03:40AM by maoxingren

How can make it easier to have variables used across my Express app?

What I currently do is is in my app.js// global vars app.locals.base_url = "http://ift.tt/2s3JdPi" and then in my routes/index.jsrouter.get('/trivia', function(req, res) { var db = req.db; var collection = db.collection('trivaquestions'); collection.find({}).toArray(function(err, docs_triviaquestions) { res.render('trivia', { "triviaquestionslist": JSON.stringify(docs_triviaquestions) params: { base_url: req.app.locals.base_url } }); }); }); I then reference it in my template but I wanted to know if I can do something easier, for example setting the variable in my route or...what do most people do?

Submitted June 29, 2017 at 01:30AM by InsertCoinPushStart

Help! Running 3 node.js apps on a single VPS.

HelloI am attempting to run 3 bots in node.js and I am not sure how to start all three. I could do this with heroku and a proc file but I would need 3 instances. Would i be able to do thiswith npm scripts? Something like this.packag.json{ "scripts": {"start": "node app1/app1.js", "start": "node app2/app2.js", "start": "node app3/app3.js",} }I am very new to all of this. Sorry if this is an obvious question.

Submitted June 28, 2017 at 09:50PM by billionairebum

Newbie - Is this proper code design for query builder/parameterized queries

I used mysql library for my query builder. I copied it straight off the document and did something like this:router.post("/register", function(req, res){ console.log(req.body); bcrypt.hash(req.body.password, 10, function(err, hash){ if(err) return console.log(err); else{ req.body.password = hash; var sql = "INSERT INTO SCHEMA.user_authentication(first_name, last_name, email, password, age)" +"VALUES(?, ?, ? ,? ,?)" var values = [req.body.first_name,req.body.last_name, req.body.email,req.body.password,req.body.age] app.con.query(sql, values, function(err, result) { if(err) return console.log(err); console.log("1 record inserted"); }); } }); }); Just wanted to know if this is proper "code-design"; is there usually a cleaner/better way to do it?

Submitted June 28, 2017 at 09:22PM by badboyzpwns

I built a chatbot in node! Looking for reviews and critics :)

http://ift.tt/2siED3S

Submitted June 28, 2017 at 09:23PM by mrtraan

JavaScript Testing: From 0 to 80% Code Coverage

http://ift.tt/2tS8cq2

Submitted June 28, 2017 at 06:39PM by hobonumber1

NodeJS Ansible Playbook: Deploy NodeJS applications to Digital Ocean. Uses HAProxy, Let's Encrypt automated dns-01 verification, Secure firewall ...

http://ift.tt/2tYuDKz

Submitted June 28, 2017 at 06:24PM by JamesTheHaxor

Memorizing APIs and other tips for coding fluently

http://ift.tt/2o1mD7y

Submitted June 28, 2017 at 04:51PM by SarasaNews

Docker NodeJS sandbox

http://ift.tt/2tkiO3c

Submitted June 28, 2017 at 03:02PM by fluidbyte

Modernize node.js to current ECMAScript standards

http://ift.tt/1s6IVQ0

Submitted June 28, 2017 at 01:49PM by Saltones

Node.js Geocoding Proxy with Paperplane

http://ift.tt/2sEHzEZ

Submitted June 28, 2017 at 10:31AM by dobkin-1970

Tuesday 27 June 2017

Do you close your RabbitMQ connections?

Hi allI have a node app (server) which takes traffic data and sends it to a RabbitMQ queue. The traffic data comes from multiple clients, so it's constantly accepting traffic data from clients and sending it over to RabbitMQ.My current code does not ever close the connection:amqp.connect('amqp://user:pass@ip', function(err, conn) { conn.createChannel(function(err, ch) { var q = 'queue'; ch.assertQueue(q, {durable: true}); ch.sendToQueue(q, new Buffer(JSON.stringify(data)), {persistent: true}); }); }); As you can see, at no point is the connection closed.Is this a problem? Is there a better way to handle it?Thank you for your comments.

Submitted June 28, 2017 at 05:35AM by just_tech_stuff

Security updates for all active release lines, July 2017

http://ift.tt/2sPpoOC

Submitted June 28, 2017 at 02:42AM by dwaxe

[Video] How to Use Twilio Speech Recognition

https://youtu.be/c_ZlQNitLgE

Submitted June 28, 2017 at 12:28AM by mmsme

How to build an image moderation system with Node.js

http://ift.tt/2qjB0F2

Submitted June 27, 2017 at 11:04PM by agrandiere

Today I published http://ift.tt/2rZc1bE, a module that take an Electron Accelerator and convert it to a derived Keyboard event.

http://ift.tt/2rZc1bE

Submitted June 27, 2017 at 09:11PM by parro-it

Initializing Objects inside functions

What's your take on initializing Objects inside functions. E.g. aws-sdk needs to be initialized inside each function in order to be mocked.Like this:const AWS = require('aws-sdk'); module.exports.getRecord = function (id) { const client = new AWS.DynamoDB.DocumentClient(); return client.get({....}).promise(); } instead of:const AWS = require('aws-sdk'); const client = new AWS.DynamoDB.DocumentClient(); module.exports.getRecord = function (id) { return client.get({....}).promise(); } Will this have an impact on performance/memory? Are there any drawbacks?

Submitted June 27, 2017 at 09:21PM by kostarelo

Introduction to Redis + Node.js

http://ift.tt/2sezp9k

Submitted June 27, 2017 at 08:40PM by HaeziSoya

Getting CORS error while using socket.io / nginx / node

I'm getting this error log from chrome's consoleXMLHttpRequest cannot load http://ift.tt/2sO2vv4. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 500. I am using Node.js, socket.io to talk between my node and react.js, with a digitalocean's droplet using nginx to host them.I've been reading a lot about CORS errors and I am unsure where to fix the error. I've been trying to allow them in my NGINXlocation /server { proxy_pass http://localhost:8080; proxy_http_version 1.1; proxy_set_header Access-Control-Allow-Origin *; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } And from my node.js, server side:var express = require("express"); var app = express(); var http = require("http"); var port = 8080; var io = require("socket.io").listen(app.listen(port)); app.use("/", function (req, res, next) { res.status(200).send("Online |" + " Version : [" + AppVersion + "]"); res.setHeader("Access-Control-Allow-Origin","*"); res.setHeader("Access-Control-Allow-Headers","X-Requested-With,content-type"); res.setHeader("Access-Control-Allow-Methods","GET,POST, OPTIONS, PUT, PATCH, DELETE"); next();}); And I connect on the client side using:const socket = io.connect("http://ift.tt/2thikLM") I am not really sure where and what I should look for. Any kind of help would help. Thanks! First time posting in /r/node, sorry if this don't belong here.

Submitted June 27, 2017 at 08:02PM by KerryGD

Building Applications with Node.js, Angular, and Couchbase (video) | The Couchbase Blog

http://ift.tt/2sje1uK

Submitted June 27, 2017 at 08:08PM by pmz

CFP for NodeConf Argentina is open

http://ift.tt/2siTNRT

Submitted June 27, 2017 at 06:04PM by a0viedo

Getting an error when pushing to heroku

The error I get from the terminal is in the gist below and it seems to originate from this line "cross-env NODE_ENV=production babel src/ -d lib/".http://ift.tt/2shXtmZ

Submitted June 27, 2017 at 03:47PM by FortuneBull

Node.js Performance Monitoring with Prometheus

http://ift.tt/2shAYyo

Submitted June 27, 2017 at 02:06PM by hfeeri

Microservices with Grenache - Bitfinex blog

http://ift.tt/2rz9LvH

Submitted June 27, 2017 at 09:32AM by katerina-ser60

Monday 26 June 2017

10 Reasons that Make Node.js a Top Choice for Web Application Development

http://ift.tt/2ubsFpi

Submitted June 27, 2017 at 06:41AM by cristinereyess

Is NPM a CLI?

I'm just starting to learn how to use node.js / npm, and have been toying with it for a few months, but I'm trying to wrap my head around it still.Is node package manager a kind of command line interface (CLI) for installing packages?

Submitted June 27, 2017 at 05:14AM by stoned_phillips

Authentication status checking over websockets

Hello, I want to implement certain functionality in web app. For example, I have two opened browser tabs of my web app, if user logs out in one tab of browser, it should automatically log out in other tab. I thought to achieve this, we should implement some sort of "subscription" via websockets to check if user is logged in, and if user logs out, state change would affect every tab and would act accordingly.So my question is, does this make sense, to check status of authentication via websockets ?Thanks !

Submitted June 27, 2017 at 12:42AM by Polisas

memoryjs - reading from and writing to memory in Node.js (game hacking)

http://ift.tt/2sKsnb3

Submitted June 27, 2017 at 12:00AM by AndroidL

JavaScript router to code the front-end like the back-end with Express

http://ift.tt/2ckou6O

Submitted June 26, 2017 at 10:49PM by camelaissani

Handling multer file validation errors

Hi,I have the following to handle file uploads: app.post('/api/upload', multer({ fileFilter: function(req, file, callback) { if(path.extname(file.originalname) !== '.csv') { return callback(new Error('Only csv files allowed!')); } callback(null, true) }, dest: './uploads' }).single('csvFile'), function(req, res) { csvParser(req, res); }); What I needed is to pass the error message 'Only csv files allowed!' to my front end (vuejs). The code callback(new Error('Only csv files allowed!') sends a response to the client, with the response body containing an entire HTML document detailing the error.Is there a way to extract only the error message 'Only csv files allowed!' on the client side?

Submitted June 26, 2017 at 05:46PM by raccoonranger73

Last Week in Node.js Working Groups - June 19th

http://ift.tt/2sJ03WG

Submitted June 26, 2017 at 05:02PM by _bit

Node.js blog framework tutorial: E-commerce with Hexo

http://ift.tt/2s9iLrE

Submitted June 26, 2017 at 04:02PM by Tiewrap24

MongoDB Native Driver - How to best notify client socket that a document has changed?

I'm developing a Microservice based application with Express, Socket.io and MongoDB native driver. We originally had Mongoose, so when we needed to push a new version of an object to the client, it was very easy with Mongoose - register the "post-" hook and send it.We had to get rid of Mongoose, because we had issues working with it in our specific use case, and we are triggering the notification in every service/model method manually now.I have looked at Meteor, its Mongo library is pretty much what we need, except it's tied to Meteor, so it probably won't work outside of it.Are there any better ways of solving this problem?

Submitted June 26, 2017 at 02:25PM by poom0nster

Build a Weather Website with Node.js + Express + OpenWeatherMap API (Tutorial)

http://ift.tt/2tcKRSy

Submitted June 26, 2017 at 02:34PM by web-dev-123

Question about deployment on Windows

Hi /r/node!I've gotten together an express app that I want to deploy on a windows server, but I have a few issues.First is how to deploy this and have the server run without user interaction on Windows.First Attempted Option:I've used Pkg from Zeit to compile the app into a standard windows EXE file, but I'm too unfamiliar to break out things like config files and log files from the main executable.Second Attempted Option:I've also attempted to do this via node-windows and install the app as a windows service, but then I find that the tool doesn't respond to requests. (could be an issue with the port assignment.) I get logging from this version, but nothing to do since I can't send requests to it.Third Attempted Option:I've also tried to get the tool run as a scheduled task in windows by using the Node executable as the program to open, then the path to my Index.js file as a commandline argument. (goes nowhere, does nothing.)TL:DR; Deploying express/node on windows, want help figuring out how to deploy to windows, and have everything available.

Submitted June 26, 2017 at 01:39PM by cjrutherford

looking for updated express/koa router with Joi validations and Swagger generator (like righty)

Hi.I looked into this project: http://ift.tt/2sSxPqG seems awesome! an Express router with build-in Joi validations and Swagger documentation auto generated.Unfortunately, this one is not up to date.Do you know any similar project? (router + Joi + Swagger auto-documentation).I know that Hapi has these options, but I want to use only express or koa.Thanks!

Submitted June 26, 2017 at 12:48PM by liri33

Create React App with Express in Production

http://ift.tt/2th74LU

Submitted June 26, 2017 at 09:16AM by ginger-julia

Sunday 25 June 2017

How to make universal JavaScript applications — Part 1

http://ift.tt/2s78kVy

Submitted June 26, 2017 at 05:49AM by Piercey4

[?] Express Routes: How can I extend route URLs?

I am learning about creating REST API's using Node.js and Express.js. I come from a C# background.Typically routes are structured like this:*GET* server.get('/info/:param_string', function(req, res, next) { res.send(201, "hello " + req.query.param_string); return next(); }); Where the URL is: localhost:3000/info/:param_stringI wish to achieve this: localhost:3000/info/ **getInfo** /:param_stringHow can I add the 'getInfo' text into the URL?When I try and add the 'getInfo' text in the code above, I receive an error such as: Cannot GET /info/getInfo/:query_stringUsing express, is there a way to achieve custom URL endpoints like that?ThanksExtra bonus points if you can also tell me how to use this same functionality using Restify

Submitted June 26, 2017 at 06:13AM by Champion01

Authentication using PassportJS (with Facebook Oauth) and MySQL (not MongoDB)

Newcomer to this sub, and I have a question regarding a personal project I'm working on.I'm using Node.js, Express, and MySQL to implement a web application. I decided to add authentication using Facebook, and discovered that PassportJS is the best option. However, every tutorial I come across uses MongoDB as the database and not MySQL. Is there any way to use MySQL as the database instead of MongoDB? I have a completely working database with MySQL, and don't want to have to translate it to Mongo, unless it is the better option.Any suggestions or thoughts are appreciated (:

Submitted June 26, 2017 at 01:42AM by deathcat5

Vim node.js completion?

Question for fellow Vim users out there. What do you use for completion (not necessarily auto-completion, CTRL-x CTRL-o is sufficient and preferable for making the completion window pop up)?Doing some googling, nothing is jumping out at me and figured I'm not the first node.js developer that uses Vim.EDIT: I should have explained this originally, but I used to use YouCompleteMe for this purpose (if I remember correctly it gave me node.js completion) but that's such a huge plugin that comes with much more than I need, and in an effort to slim down my vimrc I'm here asking.Thank you in advance!

Submitted June 25, 2017 at 05:46PM by chillysurfer

Any idea why this PATCH method wont work?

router.patch('/user/:id', function(req, res, next){ User.update({_id: req.params.id}, {$set: req.body}).then(function(){ User.findOne({_id: req.params.id}).then(function(user){ // console.log(req.body.assets[0].location.coordinates); // console.log(user); res.send(user); }); }); }); So above is my patch method which I would like to update part of an array however it is just clearing the array and replacing it with the one value passed.Example of the patch request: localhost:4000/api/user/592c851cb7beb31a9c2bfd74Body: { "assets" : [{"name": "number1", "location":{"type": "point", "coordinates": [-83.500, 24.10]}}] }Thanks, Ed.

Submitted June 25, 2017 at 04:32PM by thelynched

Enterprise Conversations Episode 13: Node.js and Intel

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

Submitted June 25, 2017 at 03:36PM by katerina-ser60

node-cntk: Use CNTK Deep Learning models from node.js

http://ift.tt/2rGFSWf

Submitted June 25, 2017 at 09:14AM by nadavbar

Saturday 24 June 2017

I am a web dev noob deploying Node.js, express, knex app on Heroku - my app is uploaded and database is set up but I can't seem to config knex properly to have my heroku app make queries to database? Any help appreciated

Hi all! Super big noob here only started coding 4 weeks ago so I apologize if this question is incredibly ignorant. I am deploying this small node.js express and knex web app on Heroku, everything runs well locally. So far I have created the app successfully from the commandline, all the pages render. I have created the postgresql database on heroku, i have successfully done migrations so my tables are all set up but when i try to submit a form which is suppose to insert data into the database I keep getting this error in the logs:2017-06-25T06:01:57.360120+00:00 app[web.1]: Unhandled rejection Error: Pool is destroyed 2017-06-25T06:01:57.360123+00:00 app[web.1]: at Pool.acquire (/app/node_modules/pool2/lib/pool.js:162:12) 2017-06-25T06:01:57.360124+00:00 app[web.1]: at /app/node_modules/knex/lib/client.js:268:29 2017-06-25T06:01:57.360125+00:00 app[web.1]: at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9) 2017-06-25T06:01:57.360125+00:00 app[web.1]: at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:483:18) 2017-06-25T06:01:57.360126+00:00 app[web.1]: at new Promise (/app/node_modules/bluebird/js/release/promise.js:79:10) 2017-06-25T06:01:57.360127+00:00 app[web.1]: at Client.acquireConnection (/app/node_modules/knex/lib/client.js:264:21) 2017-06-25T06:01:57.360131+00:00 app[web.1]: at /app/node_modules/knex/lib/runner.js:188:47 2017-06-25T06:01:57.360132+00:00 app[web.1]: at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9) 2017-06-25T06:01:57.360134+00:00 app[web.1]: at /app/node_modules/knex/lib/runner.js:187:35 2017-06-25T06:01:57.360133+00:00 app[web.1]: at new Promise (/app/node_modules/bluebird/js/release/promise.js:79:10) 2017-06-25T06:01:57.360135+00:00 app[web.1]: at Function.Promise.attempt.Promise.try (/app/node_modules/bluebird/js/release/method.js:39:29) 2017-06-25T06:01:57.360132+00:00 app[web.1]: at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:483:18) 2017-06-25T06:01:57.360134+00:00 app[web.1]: at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23) 2017-06-25T06:01:57.360136+00:00 app[web.1]: at Runner.run (/app/node_modules/knex/lib/runner.js:41:44) 2017-06-25T06:01:57.360136+00:00 app[web.1]: at Runner.ensureConnection (/app/node_modules/knex/lib/runner.js:186:39) 2017-06-25T06:01:57.360137+00:00 app[web.1]: at QueryBuilder.Target.then (/app/node_modules/knex/lib/interface.js:32:43)Any help at all is appreciated, I've gone through the tutorial on heroku and read through their node stuff. I don't have a Procfile set up because as I understand from my reading it's not necessary. Here is my Knex config: production: { client: 'pg', connection: process.env.DATABASE_URL + '?ssl=true', debug: true, pool: { min: 2, max: 10 }, migrations: { directory: './db/migrations', tableName: 'migrations' } } Here is my server.js:"use strict"; if (process.env.NODE_ENV !== 'production') require('dotenv').config(); const PORT = process.env.PORT || 8080; const ENV = process.env.ENV || "development"; const express = require("express"); const bodyParser = require("body-parser"); const sass = require("node-sass-middleware"); const app = express(); var pg = require('pg'); const knexConfig = require("./knexfile"); const knex = require("knex")(knexConfig[ENV]); const morgan = require('morgan'); const knexLogger = require('knex-logger'); // Seperated Routes for each Resource const pollRoutes = require("./routes/poll"); const voteRoutes = require("./routes/vote"); const administrativeRoutes = require("./routes/administrative"); const dbHelper = require("./lib/dbHelper")(knex); app.use(morgan('dev')); app.use(knexLogger(knex)); app.set("view engine", "ejs"); app.use(bodyParser.urlencoded({ extended: true })); app.use("/styles", sass({ src: __dirname + "/styles", dest: __dirname + "/public/styles", debug: true, outputStyle: 'expanded' })); app.use(express.static("public")); app.get("/", (req, res) => { res.redirect("/create"); }); app.get("/error", (req, res) => { res.render('error'); }); // Mount all resource routes app.use("/create", pollRoutes(dbHelper, process.env)); app.use("/vote", voteRoutes(dbHelper, process.env)); app.use("/administrative", administrativeRoutes(dbHelper)); // Home page app.listen(PORT, () => { console.log("Example app listening on port " + PORT); }); Again, any help is much appreciated. I used to work as an illustrator before I began learning this stuff, I'm happy to draw a portrait for whoever helps me solves this problem <3

Submitted June 25, 2017 at 07:15AM by derkynord

Can anyone recommend an up-to-date node/express book?

Currently reading Node.js in Action, but I just got to the Express chapter and the author used express 3.0.0, which is outdated and unusable. I'd rather not learn with an old version of express.Can anyone recommend any up-to-date books for me to use to learn node and express?

Submitted June 25, 2017 at 02:20AM by bskilly

CLI tool for manipulating tabulated data with javascript

http://ift.tt/2u1XhJP

Submitted June 25, 2017 at 01:08AM by jamesroutley

ORM vs parameterized queries, which do you prefer?

There seems to be a debate between picking an ORM vs parameterized queries. I believe I am underestimating parameterized queries, if I were to pick the two, I would definitely pick an ORM.From my understanding:ORM:Robustness: You need not to worry about the syntax errors you might make in writting the SQL query.Scalability: With the change in kind/amount of data you are handling. It is very common to change the database engine. You need not to worry about the breakage in query, as ORM handles that.Security: You need not to worry about the security breaches due to SQL Injections etc as the ORM already acts a protective shield against them **Parameterized Queries:Speed: Faster than ORM

Submitted June 24, 2017 at 10:36PM by badboyzpwns

Building a secure NodeJS web server with HAProxy and Let’s Encrypt on Debian Stretch

http://ift.tt/2t3DRXY

Submitted June 24, 2017 at 09:10PM by JamesTheHaxor

[Question] How do you parse JSON in version 8.1.2 with no errors?

Could someone please explain how I can parse JSON? I have tried many youtube videos but I still keep getting an error of: (node:8916) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated. . I believe it is to do with file handling as no body who is working with the modules that I am is experiecing the same issue. So could someone please help?

Submitted June 24, 2017 at 07:27PM by nightfuryninja1

Friday 23 June 2017

Building a NodeJS web server with HAProxy and Let’s Encrypt on Debian Stretch

http://ift.tt/2sM5vGw

Submitted June 24, 2017 at 04:37AM by JamesTheHaxor

Getting Started with Node.js and MongoDB

http://ift.tt/2sQzgZ0

Submitted June 23, 2017 at 09:12PM by _bit

Deploy nodejs app as container | Docker Tutorial 4

https://www.youtube.com/attribution_link?a=wQdkGc9RKLY&u=%2Fwatch%3Fv%3Dn3E45hADbhI%26feature%3Dshare

Submitted June 23, 2017 at 09:28PM by brewinstall

[Question]: Does anybody here have experience with Bookshelf.js ORM?

http://ift.tt/2sKCb3j

Submitted June 23, 2017 at 07:40PM by fabiantjoeaon

Routing Question

I've read that when passing "valuable information" (password, etc) with a param route, you should use POST, since post hides the information in the history browser. Unlike GET, which exposes it.Something like this:router.post("/login/:email/:password", function(req, res){ var sql = "SELECT * FROM airbnb.user_authenticaiton WHERE email" + req.params.email app.con.query(sql, function (err, result) { if(err) console.log(err); console.log("1 record inserted"); }); But.. isn't POST only used when you want to insert something new? Unlike GET which will retrieve stuff.In my scenario, I want to retrieve the email data. Would it still be applicable for me to use POST?

Submitted June 23, 2017 at 06:31PM by badboyzpwns

Trading cryptocurrencies, Forex, commodities stocks and more using Node

http://ift.tt/2s3s2gg

Submitted June 23, 2017 at 04:01PM by codedesi

Firebase function always return a promise but my code works even without returning a promise...

I'm used to Java, when a function says you return something. Then you should return that thing.However, I don't understand how javaScript/Node works. How is the code working and i'm not getting any errors ?Here is the function i'm taking about http://ift.tt/2tWnLfN

Submitted June 23, 2017 at 03:15PM by sohaeb

Testing Node.js Applications webinar series

http://ift.tt/2t2QBOT

Submitted June 23, 2017 at 01:49PM by gergelyke

Node.js Weekly Update - 23 June

http://ift.tt/2sy1UO1

Submitted June 23, 2017 at 01:44PM by hfeeri

How does node app work with Heroku Cron ?

Im learning nodejs and just finished my 1st app which grabs JSON from a link. I'm planning to use Heroku-cron plugin to make my app run every 5 mins to check for new JSON values.However, I noticed when running my app in my laptop's terminal,that the nodejs app won't stop unless I use ctrl + c. Will that cause a problem if I use cron without killing my app 1st ? i.e: Will there be multiple instances of my app running at same time?How should I approach this ? Hints ?update:What i'm trying to say is, how does heroku terminates the node js app so that I can re-run it again and check for json data.I guess that's the tl;dr of it

Submitted June 23, 2017 at 10:57AM by sohaeb

Creating a project generator with Node – Harriet Ryder

http://ift.tt/2rUCADd

Submitted June 23, 2017 at 08:21AM by katerina-ser60

Simple cluster module

http://ift.tt/2sx9lFc

Submitted June 23, 2017 at 08:28AM by lugrugzo

[Question] Google Cloud App Deployment Script with Nodejs

I know this is just about all general node.js but I'll just try my luck here.Is it possible to do this? I'm attempting to create a deployment script with Nodejs to push an image from the Container Registry. Basically it goes:Push code into branchBuild trigger fires in Container RegistryPub/Sub message pulled after image is finished building to run scriptScript has child_process to basically run "gcloud app deploy"Issues encountered:'data' event attached to the child process isn't doing anythingI'm not sure if its running or not.Here is my code:let deploymentStream = spawn("gcloud app deploy /path/to/yaml --image-url=/path/to/image/in/container/registry", [], { shell: "/bin/bash" }); deploymentStream.stdout.on('data', data => { console.log(`stdout: ${String(data)}`); }); deploymentStream.stdout.on('message', data => { console.log(`stdout: ${String(data)}`); }); deploymentStream.stdout.on('readable', data => { console.log(`stdout: ${String(data)}`); }); deploymentStream.stderr.on('error', error => console.error); deploymentStream.on('close', code => { console.log("Staging deployment execution status " + code); }); deploymentStream.on('exit', code => { console.log("Staging deployment exit code " + code); deploying = false; }); Anyone got any idea how to do this? Or is there a better way of doing this that I am missing? Thanks.

Submitted June 23, 2017 at 08:40AM by cruzcontrol56

Thursday 22 June 2017

Sequelize Connect ETIMEOUT with remote mysql db

Hi,I am getting error SequelizeConnectionError: connect ETIMEDOUT when trying to connect to a remote mysql db with sequelize.Connection can be established successfully when I try to connect to my local mysql db.I'm using sequelize's default db connection code new Sequelize(...) contained within models/index.js, with the following config (filled up with the correct values):"production": { "username": "root", "password": null, "database": "database_production", "host": "127.0.0.1", "dialect": "mysql" } I tried connecting to the remote db with a simple php script and it worked (so we can rule out issues on the remote db server side)Any ideas?

Submitted June 23, 2017 at 06:18AM by raccoonranger73

Dynamic SQL alternatives?

Is dynamic SQL considered to be bad practice? if so, why is that? what are the alternatives to achieve the same effect?eg;router.get("/register", function(req, res){ var sql = "INSERT INTO user_authentication (name, age)" + "VALUES (" + req.query.name + "," + req.query.age ")"; app.con.query(sql, function (err, result) { console.log("1 record inserted"); }); });

Submitted June 23, 2017 at 05:07AM by badboyzpwns

Creating an HTTPs server with Node.js and Express

http://ift.tt/2sxvYdf

Submitted June 22, 2017 at 11:31PM by nulless

Why does setting an error listener after piping a stream work?

Hey /r/node,I'm currently reading "Node.js in Action", and one of the chapters is having me write a static file server. We create a read stream from the requested path, pipe it to the response object, and then set an error listener.var server = http.createServer(function(req, res){ var url = parse(req.url) var path = join(root, url.pathname) var stream = fs.createReadStream(path) stream.pipe(res) stream.on('error', function(err){ res.statusCode = 500 res.end('Internal server error') }) }) I'm having trouble wrapping my head around why its possible to set the error listener after piping the the read stream to the response stream. If i request a file that doesn't exist, an error event is emitted as soon as 'createReadStream(path)' starts. At this point, we haven't set an error listener for the stream yet, so why does this work?My only explanation is that since createReadStream is asynchronous, that the error listener gets set before it emits an error event. If that's the case, isn't this bad code? Isn't there like a race condition between the error in createReadStream and setting the error listener? Is it not possible for the error to be emitted before the program gets around to setting the listener?

Submitted June 22, 2017 at 11:01PM by bskilly

Mikeal Rogers: Node.js Will Overtake Java Within a Year

http://ift.tt/2sRlJAI

Submitted June 22, 2017 at 07:19PM by speckz

How to Use Twilio Speech Recognition

http://ift.tt/2sVvvRX

Submitted June 22, 2017 at 06:36PM by brentschooley

Why is this taking so much RAM?

I have build my own node script which should read many json files contraining arrays from one directory, and merge them to one single file. There are 1000 files at ~2500kb each, containing an array of ~350 000 numbers (numbers up to 5 000 000 000) each. I read the values, put them into a string, and after I have read 10000 values, I append the string to the file, reset the string, and continuing reading data and writing it into the string. I think that the process should take almost the same amount of RAM all the time because the files are around the same size, and after I have read the file I delete the variable holding the data from the file. And I always write the same amount of numbers to the string before appending it into the real file. And after that I reset the string. But the program is taking more and more ram for each second, until it reaches 1,5gb, and then it crashes because of that it has no avalible RAM left. I do not understand why the RAM usage would increase. Please help me. Edit: I have tried to reduce the stack size from 10000 to 5000 but it didn't had any effect.

Submitted June 22, 2017 at 04:08PM by CMDJojo

Real Time Chat App Using Socket.IO and ExpressJS

https://www.youtube.com/playlist?list=PL3CDD0Jz5nVH2RS2rdtHJ5-c5lgUvPPy2

Submitted June 22, 2017 at 03:12PM by gauti123456

4 ways for making HTTP(S) requests with Node.js

http://ift.tt/2sTBXcc

Submitted June 22, 2017 at 11:05AM by GitW_85

Advantage and disadvantage of Node js

https://twitter.com/rinkidhiman771/status/877745115288059905

Submitted June 22, 2017 at 11:21AM by techymaria

Free eBook: RESTful Web API Design with Node.js (PDF/ePub/Mobi)

http://ift.tt/2st5OHK

Submitted June 22, 2017 at 08:58AM by PacktStaff

Kickstarter: Practical Node.js Book, 2nd Edition, Open-Sourced on GitHub

http://ift.tt/2sSfyME

Submitted June 22, 2017 at 09:33AM by tknew

Wednesday 21 June 2017

New ActionHero.js Site + Documentation

http://ift.tt/2sSF18k

Submitted June 22, 2017 at 01:59AM by evantahler

Gathering weak npm credentials [security warning]

http://ift.tt/2rWimUI

Submitted June 21, 2017 at 11:49PM by enkideridu

Build a simple Weather App with Node.js in just 16 lines of code

http://ift.tt/2to91qm

Submitted June 21, 2017 at 10:19PM by pmz

Stuck with looping in Cheerio and Request

I'm trying to scrape a web page, place all the URLS in an array and then scrape the next page in the array. But it's just looping the firs URL rather than following the next URL in the array. How do I change it so it scrapes each page?Thanks for your help.http://ift.tt/2tPbeLb

Submitted June 21, 2017 at 09:22PM by holocene7

Are http requests and system calls using separate threads of processes?

As the title says, are these bindings resulting in different processes spawning (making it async)? even in the case of network requests?

Submitted June 21, 2017 at 08:12PM by -proof

Cant get value of Request without SetTimeout

Is there a way i can make this without the SetTimeout? Here is the code http://ift.tt/2rRRPwy i have tried some ways that were explained on stackoverflow but didn't manage to make it work. Can anyone guess a better way so i don't need to wait the 5 seconds?

Submitted June 21, 2017 at 05:58PM by orien2k

Where to start; or what's the "Laravel" Of Node.js

I'm trying to figure out where to start with Node, I want to make a CMS system that I can use for myself and potentially clients as we move away from WP in a multilingual location. And, I just want to know what the best base is to start working with. In other words, what's the Laravel of Node.js, or I might just electrode.io.Things I think would be super fun is sharing code between the backend and front end as opposed to rewriting it in both, simple async (that's still there in node right), and just consolidating knowledge into one language might be really handy.Love it or hate it, Laravel's disrupted PHP. What I love about Laravel, the folder structure's done for me—routes, controllers, models all in their places—, it's an active community, simple yarn build tool, easy installation, testing, and damn it's just easy.I've build CMSs before—sure, less robust and more specific ones than say WP—so "learn javascript" isn't the type of answer I'm looking for here, just what's the direction the community thinks I should be looking in.

Submitted June 21, 2017 at 02:58PM by rjksn

Script crashing, out of memory

I Chose TypeScript For the Nostalgia

http://ift.tt/2sAj8IF

Submitted June 21, 2017 at 02:43PM by aunyks

Automate the boring stuff with Node.js: sending emails

http://ift.tt/2spsN6s

Submitted June 21, 2017 at 01:02PM by GitW_85

Define Mongoose models using TypeScript classes

http://ift.tt/2rUjeZY

Submitted June 21, 2017 at 12:39PM by tamastorok

NodeJS + PostgresSQL, what to use for creating APIs?

Hi there,I am new to the nodejs. If my DB is PostgresSQL, which package/framework would you recommend for creating enterprise level APIs?Thanks!

Submitted June 21, 2017 at 12:29PM by smallbee2

NodeJS: A Next Gen. Technology

This blog provides complete information about Node JS, how to run it web server to build a client server application.It uses to Google V8 engine to execute JavaScript code Built upon event driven architecture.

Submitted June 21, 2017 at 10:51AM by evincedevin

please revert to previous theme!

this is fucking unreadeable!

Submitted June 21, 2017 at 11:17AM by raistlinthewiz

Where to start!? I have node installed and im ready for my first project but its a minefield out there, can anyone point me in the direction of a good 1st project tutorial?

No text found

Submitted June 21, 2017 at 09:59AM by dizzyack

Kick devices off your network by performing an ARP Spoof attack with Node.js

http://ift.tt/2iVl7pm

Submitted June 21, 2017 at 10:43AM by roccomusolino

New Features and Fixes Latest Release of Node.js 8.0 brings for Developers

http://ift.tt/2szw1mo

Submitted June 21, 2017 at 06:35AM by alwaystakeithome

Accept Payments with Express, React and Stripe

http://ift.tt/2rSKCaI

Submitted June 21, 2017 at 07:38AM by rwieruch

Tuesday 20 June 2017

Build a Distributed Caching Layer with ExpressJS

http://ift.tt/2tLYuoi

Submitted June 21, 2017 at 02:22AM by robotixs

Newbie - req.body issues

I sent a JSON object to the /register route. It seems that the object is successfully sent; but... I can't seem to retrieve the values of the JSON object.Router:router.post("/register", function(req, res){ res.json(req.body); console.log(req.body); console.log("First Name:" + req.body.first_name); console.log("Last Name:" + req.body.last_name); console.log("Email:" + req.body.email); } Terminal:'{"age":84,"email":"test@gmail.com","first_name":"Matt","id":0,"last_name":"Louis","password":"lp334564a"}': '' }First Name:undefinedLast Name:undefinedEmail:undefinedWhen I use postman and visit the link of localhost:3000/register:It gave me this: { "{\n\t\"prop\":\"value\"\n}": "" } Any ideas what's wrong?

Submitted June 21, 2017 at 12:16AM by badboyzpwns

What do you think of my library?

I am finishing the first version of https://serverjs.io/ under the npm name "server". This version is basically a thin layer over express with common default options and middleware already set. The objective is that you don't have to repeat adding the same middleware again and again:const server = require('server'); const { get, post } = server.router; const route = get('/', ctx => 'Hello world'); server(route); The next minor version will add socket.io natively so creating a powerful websocket connection becomes trivial in the same way that handling a GET request is trivial now:const server = require('server'); const { get, post, socket } = server.router; const routes = [ get('/', ctx => 'Hello world'), // Listen for messages and send them to everyone socket('message', ctx => ctx.io.emit('message', ctx.data)) ]; // Launch it all server(routes); I have a couple of questions/topics I'd love feedback with:Would you use it? Why yes/no?What would you improve? What isn't clear?If you have any question about it just let me know.

Submitted June 20, 2017 at 09:38PM by franciscopresencia

ADD LICENSES USING COMMAND LINE WITH NODEJS

http://ift.tt/2tKDDC7

Submitted June 20, 2017 at 09:09PM by nodejs_ng

Node.js server app using cors, express and google api not working after azure deployment - does someone clever have a solution?

http://ift.tt/2sLOI8r

Submitted June 20, 2017 at 06:00PM by einkria

Problems using socket connection for mysql calls.

I have an app hosted on heroku and a database that is behind a firewall. The firewall can't be opened to all traffic so I looked into options and came across fixie socks (the only free option).I am using connection pooling for my dbcalls. Previously I could make consecutive calls:pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 1+1 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 2+2 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); pool.getConnection(function gotConnection(err, connection) { if (err) throw err; connection.query('SELECT 3+3 as test1;', function (err, rows, fields) { console.log('Result: ', rows); connection.release(); }); }); Now however when I try the same thing I get the followingWarning: got packets out of order. Expected 1 but received 0 If I do a single call then it works fine, but the minute I put a 2nd one in, I get the packets out of order error. Can anyone give me some insight into what I am doing wrong? Or what I need to do differently using a stream and a socket.

Submitted June 20, 2017 at 06:55PM by azazael13

Messenger Chatbot via NodeJS Help

I have made a pretty simple shell of a chatbot, and now I want the bot to be able to access users Facebook Messenger information. Primarily first name. I can not figure out how to get this to work. Any and all help is appreciated.Below is an abbreviated form of my code, with what I believe are all of the essentials. I have started on the right path, i believe. The function getName should be obtaining the name, but it is not.Code

Submitted June 20, 2017 at 07:19PM by AmbidexterousStudios

How to paginate records in MySQL using Sequelize and Nodejs

http://ift.tt/2sPbkWB

Submitted June 20, 2017 at 07:54PM by simplicius_

Looking for a console library

Hey I want to do a quick and dirty telnet webpage. I have found a telnet library. Does anyone know of a library that mimics a console like IO system with HTML5? One where I can read user input and add output to the screen?Thanks

Submitted June 20, 2017 at 03:24PM by deaf_fish

Any tips/recommendations for a frontend dev who has to build a license management web app as fast as possilbe?

I am a total backend noob, but I need a license management web app as fast as possible. I am very comfortable with Javascript so obviously node.js is my first pick, but the node.js ecosystem is enormous so I am feeling a little overwhelmed.So what I need, should be quite simple: - PostgresSQL database - Authentication (Google, Facebook, e-mail,...) - Payment processors (mainly Stripe) - Payment should work similar to digital ocean (pay in money into an "account" to pay for different properties). - Property overview and registration.So yeah nothing ground breaking I just don't really know how to start. Do you have any recommendations (frameworks, plugins, maybe a boilerplate) or tips?

Submitted June 20, 2017 at 04:18PM by BackendNoob

Building a Node.js App with TypeScript Tutorial

http://ift.tt/2tnO1jJ

Submitted June 20, 2017 at 12:03PM by hfeeri

The only useful transpiler ever

http://ift.tt/1SBxTCU

Submitted June 20, 2017 at 12:11PM by ecares

Any one had any luck using Vue Feathers.js and socket.io?

Is Vue meant to be used this way?

Submitted June 20, 2017 at 11:02AM by OzziePeck

Firebase Cloud Messaging: Handling tokens and notifications with Node.js

http://ift.tt/2rOAa40

Submitted June 20, 2017 at 09:34AM by nulless

Any advice on how to stop exceptions from crashing my HTML5 game server?

I've been making a game that's been great and fun to program, but now I'm thinking about what happens if an exception crashes my server.I read up on exceptions for node and found out that:uncaughtexceptions are VERY dangerousthe cluster module is recommended if part of a server crashes because it can be restartedthe cluster module is icky / messy with websocketsIs there something I'm missing here? I'm thinking about using socketcluster but I simply just want my server to NOT CRASH if there is an error, and at most, just restart.

Submitted June 20, 2017 at 08:10AM by Kevintrades

Quickly build an API in Node.js with Huncwot

http://ift.tt/2s126VZ

Submitted June 20, 2017 at 07:23AM by ginger-julia

Monday 19 June 2017

Can anyone share some advice as to how you'd go about implementing a private messaging system in a Node.js app?

Is there any simple ways to do this or any services that make this easy for you? I'm aware of Sendbird, but it appears that that'll only work for React Native in a JavaScript app.If it helps, I'm building it with Express and using React on the front end.I'm willing to try to build it myself, but I just wanted to make sure I'm not reinventing the wheel here.

Submitted June 19, 2017 at 10:32PM by Torus8

Revoking JSON Web Tokens with Example Node App

http://ift.tt/2sARkX5

Submitted June 19, 2017 at 09:52PM by kstra

mcollina/make-promises-safe: make promises safe in node <= 8

http://ift.tt/2tkw71h

Submitted June 19, 2017 at 08:15PM by loigiani

Introducing #NodeHelp: Sharing Node Knowledge

http://ift.tt/2sIbRZQ

Submitted June 19, 2017 at 05:13PM by _bit

Where to host?

Hello,I have created a ReactJS web application that interacts with a NodeJS API (this API uses MongoDB). I have kept these projects separate and I am working on them locally, however, I am ready to deploy them and I am wondering where the best place to host them is.Any recommendations?

Submitted June 19, 2017 at 03:55PM by acreakingstaircase

Integrating "admin-on-rest" admin interface into an existing Express API

I have an Express API built and am looking to configure an admin interface similar to Django admin. I have tried the Admin On Rest demo and really enjoyed it (http://ift.tt/2lpMXbA). It uses React components and is predictable in the way it lays out a proper admin interface.However, I'm unsure how best to integrate this into my current Express API. Admin-On-Rest is really its own single page app that just connects to any given API. Ideally, I would add the whole admin interface as its own Express route (i.e. app.use('/admin', 'link-to-admin-on-rest'));Does anyone have any resources on how to accomplish something like this? Alternatively, are there other recommended admin interfaces for a Node API?

Submitted June 19, 2017 at 04:24PM by mrc1897

I have ~60 domains on ubuntu VPSs running php/mysql/mongo/node and need a backup script what are you all using these days to do OS & DB level backups?

I initially wrote this script to do OS/DB Backups and then it evolved into a bash/node combo script [here](http://ift.tt/2tkmmAa), now it will email me when its complete and this worked fine for one domain per server but now I have a client with 60+ domains all on the same server (i know...) and need something thats a bit more flexible that will notify me on backup failures.I prefer node.js these days so any backup scripts written in node are a plus.

Submitted June 19, 2017 at 04:34PM by ndboost

/r/node has reached 30,000 readers!

http://ift.tt/2rIbH5m

Submitted June 19, 2017 at 01:47PM by tknew

What's the difference?

What's the difference between distributed sagas and event sourcing?https://youtube.com/watch?v=0UTOLRTwOX0

Submitted June 19, 2017 at 01:24PM by ppafford

Writing a Node.js module in TypeScript

http://ift.tt/2sHgSzd

Submitted June 19, 2017 at 10:36AM by dobkin-1970

Sunday 18 June 2017

Node and CMS'

I've experimented with Keystone, Ghost and Cody before but haven't really dug into any. Is there anything out there like Wordpress or Grav for Node at the moment or is it too early in Node's lifespan?Do you ever see a Wordpress or Drupal-like CMS coming to Node in the future or is PHP too dominant in this regard - thanks!

Submitted June 19, 2017 at 06:36AM by wires55

Different npm start depending on environment?

I'm trying to deploy to a web app in Azure and I have it working fine. However, in my package.json, I have a "start" script which Azure needs to determine how to start my app. Currently, that's node ./bin/www. I'd like that to be something like ng build && node ./bin/www or ng build --prod && node ./bin/www depending on if my environment variable is Production or not. Is that possible?

Submitted June 19, 2017 at 04:35AM by jackmusick

Routing - When to use query vs params?

Query:/register?name="Matt"&age=100vsParams:/register/"Matt"/100From what I know, the additional benefit of queries here is that it shows the user the key and value pairs...but I think there's much more than that.

Submitted June 18, 2017 at 10:59PM by badboyzpwns

MERN stack

Hey everyone, can you suggest me any projects/resources for MERN stack??

Submitted June 18, 2017 at 10:31PM by hugoenglish

Making API calls and correcting spelling

So I have a website that takes in the city name from a search bar and it takes the input and makes an API call to my express backend which gets JSON information from a database that matches that city. So the call I make is:http://localhost:3001/api/wwtp/?q=los%20angelesand it gets me JSON information, but lets say the user mispells Los Angeles as Los Angleshttp://localhost:3001/api/wwtp/?q=los%20anglesreturns nothing.Is there a library out there that can check spelling or would I have to write something custom? I already have a list of all cities in the united states in JSON format and perhaps I can compare the user input with the list of cities. How would you approach this problem?

Submitted June 18, 2017 at 09:40PM by joeysk2012

Choo, architecture & performance

http://ift.tt/2sEFj2y

Submitted June 18, 2017 at 09:00PM by yoshuawuyts

How do NodeJS Sessions work?

http://ift.tt/2thwABx

Submitted June 18, 2017 at 07:03PM by hobonumber1

Netcat ported in Node.js - Full JS implementation!

http://ift.tt/2raitwg

Submitted June 18, 2017 at 03:25PM by roccomusolino

Top posts on Stackoverflow – Hacker Noon Top questions , answers and comments includes controversial, most edited , downvoted etc. on stackoverflow.com

http://ift.tt/2sdg1rJ

Submitted June 18, 2017 at 03:12PM by sandeepscet_redit

Best SQL databases (postgres,mysql) ORM to use?

Hi. Tried previously to use Sequelize and it was very uncomfortable to use. I'm going to build a service using Express or Koa and need a nice ORM to handle my SQL database (could be either MySQL or Postgres). any recommended and maintained library (and if you have a middleware for it - better) :)

Submitted June 18, 2017 at 02:31PM by liri33

Saturday 17 June 2017

What would be the path to files inside "scripts"? I am trying to access from "views" folder. I tried ../../scripts/file.js, ../scripts/file.js no luck

http://ift.tt/2rJ7bhM

Submitted June 18, 2017 at 03:39AM by farhansyed7911

nodejs, yo, Docker local dev container issue

Please don't be offended, but I am not using Docker for it's main use case (deployment). I'm trying to set it up as a local development container to forgo having to install dependencies to my host machine. I am so close to getting this to work.I have a node js Docker image with an alpine base and mount my code files into the container on run. However, when I run:yo -vI get the following error.I have tried adding a local user and elevating it, but still no luck. I'm convinced this isn't necessarily a permission issue, but a yeoman specific issue regarding a global installations and Root. I have tried the solutions here regarding chmod to no avail.Here's my Dockerfile for reference:FROM mhart/alpine-nodeRUN npm install -g yeoman-doctorRUN npm install -g yoRUN npm install -g generator-express-mysqlEXPOSE 8080ENV NODE_ENV developmentCMD [ "tail", "-f", "/dev/null" ]

Submitted June 18, 2017 at 03:48AM by Wallblacksheep

Fawn - Transactions for MongoDB (JavaScript)

http://ift.tt/2sEdUeI

Submitted June 17, 2017 at 10:53PM by e-oj

How do I delete the same document that is in multiple collections

I'm using mongoDB with mongoose and would like to remove a document from all collections. This is what I have as the delete http://ift.tt/2sF20Ew

Submitted June 17, 2017 at 09:57PM by eyyRudeBoy

Pylor: a REST helper and ACS for Express and the browser

http://ift.tt/2tehBYR

Submitted June 17, 2017 at 07:25PM by Pleochism

I made a boilerplate repo for express that implements my build structure at the most basic level. Use it if it helps, comment/suggest ideas if you have any.

http://ift.tt/2te1t9E

Submitted June 17, 2017 at 05:44PM by spel3o

Need help with Exporting sendMail using Nodemailer

So I can get the example shown on nodemailer to work when I run the whole thing in one script, but I want to export a function so I can just call sendMail(to,subject, text) from my other js files and It'll send an email.

Submitted June 17, 2017 at 03:04PM by eyyRudeBoy

CloudBoost: Open Source Serverless platform built with Node

http://ift.tt/1QaWJed

Submitted June 17, 2017 at 10:05AM by nawazdhandala

Friday 16 June 2017

Express.js - Where do you keep your regularly used functions?

I have a few functions that I use in various places in my node/express app. I was wondering how others store these kinds of functions.Do you simply put them all in one file, or put each function in its own file insider a folder?

Submitted June 17, 2017 at 07:09AM by MonkeyOnARock1

Extend Routing

http://ift.tt/2rGzwFE

Submitted June 17, 2017 at 05:59AM by Mikhail-Kotykhov

Web application for api management and creation ?

Would this be a very helpful tool for people in backend department specifically people who create rest apis in nodeJS

Submitted June 17, 2017 at 12:43AM by andreGarvin1

Express Routes: Is it possible to call on another route and use its response in my current route?

Basically, I want a route that can play off of the raw data that is sent from another route. I want to take that raw data and process it into a .csv file and export it for download in the browser. Is this possible? I'd love some expert opinions!

Submitted June 16, 2017 at 09:20PM by snahrvar

StreamBeans - A beancounter to collect metrics for your streams.

http://ift.tt/2rFabM9

Submitted June 16, 2017 at 10:02PM by mrkmg

How would I go about doing this?

I am having trouble thinking how to achieve this.I would like to take a given article url and when entered shoot out some bullet points on the article.Getting the article's text is easy, I'm just wondering how I should make the key points into bullet points.Any suggestions?

Submitted June 16, 2017 at 07:47PM by farhansyed7911

Analog to digital

Looking for someone with experience using analog to digital converter with nodejs and a soil moisture sensor. It seems like a stretch, but I'm hoping someone is out there or someone can point me in the right direction. I know I've seen it done with Python, but I'd rather stick to node since the rest of my project is in node.Using this ADC and using this sensor hooked up to a raspberry pi and breadboard with pi cobbler type attachment. Still waiting on the ADC to come in from Amazon.Thanks in advance.

Submitted June 16, 2017 at 02:57PM by ironshoe

Chrome Extension - Enable the old twitter UI

http://ift.tt/2tuXuFd

Submitted June 16, 2017 at 02:00PM by kamranahmed_se

Third-party chatBot

I've tougth about develop a third-party (client side) chat-for some website-forum. But it's require login and I don't know how to send ajax request to login... Answers ?

Submitted June 16, 2017 at 11:49AM by iDankMyMemes

Chrome Extension: Get your old twitter UI back

http://ift.tt/2rDeFTO

Submitted June 16, 2017 at 12:44PM by kamranahmed_se

Node.js Weekly Update - 16 June

http://ift.tt/2swrzac

Submitted June 16, 2017 at 11:08AM by hfeeri

Can someone critique my npm workflow?

I am using npm as a task runner to help me develop the frontend of a web application. I'll give you a rundown of the project first and then ask my questions at the end.My project structure:src/ (.js, .scss files) assets/ (media files) public/ (build output files) index.html My package.json (the important parts):{ ... "scripts": { "start": "npm run http-server", "dev": "concurrently --kill-others \"npm run node-sass-dev\" \"npm run browser-sync\"", "build": "npm run node-sass", "http-server": "http-server .", "browser-sync": "browser-sync start --server --files src/* public/* index.html --no-notify", "node-sass": "node-sass src/style.scss > public/style.css", "node-sass-dev": "node-sass --watch --recursive --output public --source-map true --source-map-contents src" }, "author": "anonymous7102", "dependencies": { "http-server": "^0.10.0", "node-sass": "^4.5.3" }, "devDependencies": { "browser-sync": "^2.18.12", "concurrently": "^3.4.0" } ... } Scripts explanations:start runs the http-server, serving the root directory.dev runs the node-sass watcher/compiler and browser-sync so that code edits are mirrored to the browser in realtime.build builds the project (currently just compiling sass files).The rest of the scripts are just to make each respective command less verbose when I call them in start/dev/build.What I would like to improve about this workflow:I would like the built site to be served completely out of /public, with index.html, all scripts and assets copied in there.For simply building the site, I could just run what compilers are needed and copy index, src, and assets into /public using some platform independent npm package commands (like copy). Then serve public with http-server. Easy.The thing that I am confused about is, how can I make this work with dev? Everything, including index.html, /src, and /assets would need to be watched and copied into /public on a file change or addition. Then I could use browser-sync to serve /public instead. Is there a package that I don't know about that makes this easy to do?

Submitted June 16, 2017 at 08:29AM by anonymous7102

Top 15 Effective Node.Js Tools Web Developers Shouldn't Miss

http://ift.tt/2rxRG0U

Submitted June 16, 2017 at 08:49AM by carlpro

Redbird: A modern reverse proxy for node (with built in Cluster, HTTP2, LetsEncrypt and Docker support)

http://ift.tt/1AUFsud

Submitted June 16, 2017 at 08:28AM by laggingreflex

Thursday 15 June 2017

My laptop runs SailsJS apps but my desktop doesn't. I have no clue why I get a hook failed to load error.

Javascript Destructuring Assignment

http://ift.tt/2t8bK7e

Submitted June 16, 2017 at 03:30AM by iWantedMVMOT

Attaching a file to an email sent with googleapis

I've been scratching my head on this for the last couple of weeks, and I feel like it's something obvious that I'm not quite understanding. I've managed to compose and send an email with code I found on StackOverflow...function sendEmail (auth, sender, recipients, subject, body, options, callback) { var raw = makeBody(recipients.join(','), sender, subject, body) gmail.users.messages.send({ auth: auth, userId: 'me', resource: { raw: raw } }, function (err, response) { if (err) { console.error(err) } console.log(response) }) } /* http://ift.tt/2tsoANb */ function makeBody (to, from, subject, message) { var str = ['Content-Type: text/plain; charset="UTF-8"\n', 'MIME-Version: 1.0\n', 'Content-Transfer-Encoding: 7bit\n', 'to: ', to, '\n', 'from: ', from, '\n', 'subject: ', subject, '\n\n', message ].join('') return btoa(str) } ...but when I try to modify the first object in gmail.users.messages.send to include a media object that looks like so...media: { mimeType: 'text/plain', body: fs.createReadStream('someFile.csv') } ...I get an error in the callback saying text/plain isn't supported, and only message/rfc822 is. I have no idea how to make that happen, and I was relying on the part of the README that said readable streams could be used (though I suppose that's only for v3 of Drive).So I'm guessing I need to read in the file, encode it as a message/rfc822 in some way similar to makeBody works, and then insert that as media.body? If so, I'm at a loss for how. I'm getting lost reading the W3's documentation on message/rfc822.

Submitted June 15, 2017 at 11:17PM by pm_your_moneymaker

A personal blogging theme for Ghost built using Bootstrap 4

http://ift.tt/2rwuoZi

Submitted June 15, 2017 at 10:27PM by lauroengineer

Browsersync - Time-saving synchronised browser testing

http://ift.tt/22PaD97

Submitted June 15, 2017 at 10:43PM by Saltones

Simplifying 'require' path for Node.js addon?

Enforcing Uniqueness With MongoDB Partial Indexes in Node.js

http://ift.tt/2sx5QzD

Submitted June 15, 2017 at 08:55PM by code_barbarian

[Help] - 'npm run script1.js; npm run script2.js' vs synchronous exported functions via bin executable

I'm currently testing two approaches to some build scripts for a set of projects and running into (what appears to be) a race condition when executing npm scripts in different ways.The two specific scripts first (script1) copy a set of files into a single directory, and then (script2) modify and re-write said files based on some regular expressions.script1.js:for (let file of files) { let fileSplit = file.split("/"); let fileName = fileSplit[fileSplit.length - 1]; let readStream = fs.createReadStream(file); let newFile = path.join(outDir, fileName); readStream.pipe(fs.createWriteStream(newFile)); } script2.js// some regex modifications fs.writeFileSync(file, code, "utf8"); When running these back-to-back as an npm script via my package.json, the files are properly copied and then modified accordingly:{ "scripts": { "build": "npm run script1; npm run script2;" } } However, when running these as a bin command, it seems as if many of the files (most) are not properly copied from script1, before the second exported function from script2 is run.var script1 = require("script1.js"); var script2 = require("script2.js"); script1.main(); script2.main(); { "bin": { "build": "./index.js" } } It feels like using these exported functions as a bin command via index.js is encountering a race condition/asynchronous issues compared to the semicolon delimited npm script approach. Any advice on why this occurs/how to resolve it?Thanks

Submitted June 15, 2017 at 08:33PM by fugular

Google image search with Curl and Nodejs

http://ift.tt/2t6NKla

Submitted June 15, 2017 at 07:52PM by indatawetrust

Express: only 'app.get' routes actually send a response…app.put,post, and delete all get redirected to my 404.

Not really understanding what's going on. Here is my full code:const express = require('express'); const bodyParser = require('body-parser') const path = require('path'); const app = express(); app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.json()) app.use(bodyParser.json({ type: 'application/vnd.api+json' })) //Root API app.get('/api', function (req, res) { res.status(200).send('API is working.'); console.log('API IS WORKING!!!'); }); app.post('/api/post-example', function (req, res) { console.log('About to post...?'); res.send(req.params); }); //This allows the React server to access the Express socket app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "http://localhost:3000"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.header("Access-Control-Allow-Credentials", true); next(); }); //Redirect for unknown routes app.use(function(req, res) { res.status(404).send('This page dont exsit bro.'); }); module.exports = app; So basically, whenever I change the .post method to .get, everything works fine, but everything else is just not working for some reason. The whole app is exported into an index.js file running on Port 3001

Submitted June 15, 2017 at 04:07PM by tangerto

Thoughts on golang?

Wondering whether people think golang or node is to have the brightest future. Also in anyone running typescript on server side JS? I just started learning go but I find JS has less overhead to get things done.

Submitted June 15, 2017 at 04:23PM by -proof

Why my mysql query result contains FieldPackets?

Hello, im trying to render data from mysql in my .ejs file but i dont know why my result contains FieldPackets:[ FieldPacket { catalog: 'def', db: 'db', table: 'books', orgTable: 'books', name: 'id', orgName: 'id', charsetNr: 63, length: 11, type: 3, Here is my code: async.parallel([ function(callback) { mysqlConnection.query('SELECT * FROM books', callback) }, function(callback) { mysqlConnection.query('SELECT * FROM users', callback) } ], function(err, results) { console.log(results[0]) res.render('data', { books: results[0], users: results[1] }); }); I want only RowDataPacket becouse i need to render row objects I dont know if i render it correctly:
    <% books.forEach(function(ind){ %>
  • <%= JSON.stringify(ind) %>
  • <% }) %>
It would be great if someone could help me :)

Submitted June 15, 2017 at 03:10PM by elderdruid3

How to get, use, and close a DB connection using the Async module in NodeJS

http://ift.tt/2s57dE4

Submitted June 15, 2017 at 03:30PM by dmcghan

Node 8 and npm@5 release: What's new?

http://ift.tt/2rnr03c

Submitted June 15, 2017 at 02:43PM by speckz

How to use Express and Passport Auth inside one route?

When using Express and Passport, is it possible to use the same route for both authorized users and new ones? Right now the complete route have to be protected by a Passport Strategy. Would something like this be possible? app.post('/test', function (req, res, next) { if(req.isAuthorized){ //Do something } else { //Woh! The user is not auth, do something else } } I could have a test-route that only allows authorized users, but then I would have to use a completely different route when they are not authorized, like test2... It such a small function I need and I would like to write it in the same route and controller, so the question is: Is it possible to use Express and Passport and in the same route, check if the user IS authorized? Thanks!

Submitted June 15, 2017 at 02:40PM by ProfessorRekyl

Hello everyone I am the author and creator of a open source project called clib, a node module built for creating cli tools much faster and easier. Checkout and use to build amazing cli tools send some pull request or issues

http://ift.tt/2tqaZWC

Submitted June 15, 2017 at 01:59PM by andreGarvin1

Build an API with Koa.js

http://ift.tt/2qKYd3h

Submitted June 15, 2017 at 10:28AM by harlampi

Wednesday 14 June 2017

Fastest way of making a get-request to some api

What would be the fastest way of making a simple get-request to a server? I don't care about the answer and want to cut down as much as possible to make it as fast as possible.So far I am doing something like this:var request = require("request");request(url, function (error, response, body) {console.log(body);}I found a module called "req-fast", that seems to perform better, but at the same time it doesn't seem to support https, so it wasn't the right library for me.Any ideas of what to do / what to improve?

Submitted June 15, 2017 at 04:16AM by cephii2

Habits of a Happy Node Hacker

http://ift.tt/2rhq38i

Submitted June 15, 2017 at 03:16AM by masterJ

Check out my project and collaborate

http://ift.tt/2sBcG6X

Submitted June 14, 2017 at 08:33PM by JackAppDev

[Question] Node.JS resources that are worth sharing?

Like many people before me, I managed to find myself working with Node.js.I finished an 18 hour course and was finally able to start working on the back-end that I wanted to create.Halfway through my project and creating everything by hand, I stumbled upon a yeoman generator that easily scaffolds Node modules for me.Which made me wonder what else is out there.tl;dr - What Node (or express) resources / plugins are almost essential to your workflow?

Submitted June 14, 2017 at 07:39PM by Feeds_On_Anger

Fastest way of handling arrays in Node.js C++ Addon?

New to Node: How to best troubleshoot error?

Hey Guys,I have a project I'm working on where I'm running into an error in one of my API endpoints. The API accepts and parses a JSON (Watson speech to text transcription).The error only occurs when the JSON sent to it is large. (6min video no issues, 1 hour video causes 500 error).The error does not crash the app but causes a 500 error and the route exits prematurely. I've identified the code that causes the error:let confidenceSum = wordConfidenceArr.reduce((total, num) => { return total + num[1]; }, 0); My question is more general than just what's wrong with my code. My question is how do I go about troubleshooting the error? All I see is the console error:Write JSON Write TEXT get wordConfidenceArr add wordConfidencetotal POST /api/watson/results 500 451.141 ms - 3346 edit: What I've done so far to troubleshoot is add a whole bunch of console logs to see where the error occurs. I've also commented out that specific peace of code and that gets rid of the error. As far as I can tell the reduce method is correct, and seems to work on smaller JSON samples. I will try to rewrite the .reduce with a plain for loop but don't know why it would fail in the first place.Thanks for your help in advance!

Submitted June 14, 2017 at 04:52PM by b0z33

https request is not working and I don't know why

I can access http://ift.tt/2t1Hhbd in the browser. When I run the following code I get no response. If I switch the url to google it works fine.const https = require('https'); https.get("http://ift.tt/2t1Hhbd", (res) => { console.log('statusCode:', res.statusCode); console.log('headers:', res.headers); res.on('data', (d) => { process.stdout.write(d); }); }).on('error', (e) => { console.error(e); }); { Error: read ETIMEDOUT at exports._errnoException (util.js:1018:11) at TLSWrap.onread (net.js:568:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }

Submitted June 14, 2017 at 03:55PM by cowardly_lying

Scaffold APIs with ExpressJS and Swagger

I want to share a new Yeoman generator that I created for Nodejs API applications.The generator scaffolds a new project and includes API validation, interactive API documentation, structured logging, ES.next, and a transpilation pipeline.I'm hoping it proves useful for folks. Also, please send along suggestions. I'd like to continue to improve on it.You can check it out here: http://ift.tt/2t1IlMc

Submitted June 14, 2017 at 02:59PM by coracarm

Survey: Node.js Developers Struggle with Debugging & Downtimes

http://ift.tt/2tloirx

Submitted June 14, 2017 at 01:29PM by hfeeri

Hacker News API demo built with Node.js and GraphQL

http://ift.tt/2snEx9U

Submitted June 14, 2017 at 12:03PM by koistya

Advantages & Disadvantages of Using Node JS

https://twitter.com/paulinawilson82/status/874906616201662464

Submitted June 14, 2017 at 10:08AM by carlpro

Build a Serverless Twilio SMS Bot and Call Center in 7 Minutes with Node.js + StdLib

http://ift.tt/2s9uYcP

Submitted June 14, 2017 at 10:05AM by J-Kob

A modern node.js framework Nest 3.0.0 is here!

http://ift.tt/2mMuHMR

Submitted June 14, 2017 at 09:22AM by mysliwik

Come join the Rocket Squirrels, a team of webdevs on Slack

Hey everyone,Nearly 3 years ago I posted on here that I wanted to gather a small team of web designers, coders, and webdevs, to create a Slack team. The purpose behind the group is to create a team which can help each other with troubleshooting, share industry news and best practices, as well as keep each other sane during those long projects.I'm really happy to say that over the past 3 years, 158 people have joined the team, and now we're looking for the next group of skilled webdevs to join us!We are looking for people who are moderately experienced in either web design, programming / coding, graphic design, digital marketing (doesn't matter which field you prefer), WordPress, node, angular, PHP, .net, python, ruby, sysadmins, hosting, devops, or any field related to the ones above.Most of our members are self-employed, freelance, or employed, with varying skillsets and experience. There's no commitment, chat when you're free. We chat almost every day, though it's always second to work commitments. We've also got some channels dedicated to gaming, movies, hardware, music, and more!If you're interested, you can enter your details on our signup page and we'll approve your application, then you'll be able to join the Slack team. Alternatively if you'd like more information, please send me a direct message.Darren from the Rocket Squirrels

Submitted June 14, 2017 at 07:57AM by dmpinder

Tuesday 13 June 2017

Server Side rendering or Client side ? What to do when your server side needs to send a lot of data to a particular end point

So say I have a url end point of /game, in game I have a lot of information that is coming from the database...so do I just pass everything to the render function after I query from the database ? I am talking like 10 different objects here. This is going to be big ! How exactly should this be handled ? Here is a very simple example...app.get('/game', (res, req) => { queryDatabaseHere().then((data)=>{ querySomeMoreData.then((moredata) => { res.render('game.ejs', {a:353}, {data:data}, {b:2354}, {moredata: data}, .... etc. etc. more data would be passed here.) }) }) }) Oh but I'm not done...now I have another page called /anothergame, it needs to show 15 objects, and 10 of those are the same as /game...surely my application is getting big...how exactly should I handle passing this amount of large data to my views ? What happens if I have to have, say a header that must always contain your profile information that comes from the database ? Now for every page I must always ping the database ? Are 'global' variables allowed inside views ? Or is Client Side (say React) with and API endpoint is the way to go ? Any direction or advice would be appreciated.

Submitted June 14, 2017 at 04:26AM by HappyZombies

node-organizer package

Hello guys. I made a project that organize your files into a classified folder structure. Can you help me improve it?node-organizer

Submitted June 14, 2017 at 03:09AM by guilherme-lcd

TestCafe v0.16.0 is here with TypeScript support and seamless testing in headless Chrome and device emulator 🚀🚀

http://ift.tt/2sxQB9c

Submitted June 13, 2017 at 09:28PM by henry_tula

Node 8 and npm@5 release: What's new?

http://ift.tt/2rXl2Vk

Submitted June 13, 2017 at 07:22PM by Ramirond

How to handle street address data?

I am writing a web app that stores the location of offices across the world. At some point I want users to be able to find the closest office by displaying pins on a map. Currently I am using sequelize as my ORM with postgres. Any recommendations for how to store the data, how to validate the address, etc?

Submitted June 13, 2017 at 06:44PM by cemclaug

ODBC Drivers

Ok so I have data in both PostgreSQL and MS SQL databases and I need to use both in my API. Does anyone know of any ODBC drivers that work with both MS SQL Server and PostgreSQL?Thank,

Submitted June 13, 2017 at 04:29PM by laroyster

Here’s what you need to know about npm 5 - Pusher Blog

http://ift.tt/2sxiWwz

Submitted June 13, 2017 at 04:10PM by Yomete

/r/node has a fresh new look!

https://twitter.com/keymetrics_io/status/874634121686986752

Submitted June 13, 2017 at 03:27PM by tknew

Monday 12 June 2017

Question about a node.js app I am using

hello, I am not familiar at all with java script or Node.Js in general. I bought a piece of software from an individual on a forum (cryptocurrency related) and it is written in Node.Js. He grants you a licence by adding your bitcoin exchange api to a whitelist of some sort. What exactly is he doing? I guess I need to understand how Node.Js apps run. (I am not trying to crack the software just genuinely curious) Second question is that he claims there are machine learning aspects in his program, is Node.Js at all suitable for machine learning?

Submitted June 13, 2017 at 03:38AM by robo_reddit

react and server-side w/o redux?

the goal: grab some API data from node (server side), and send it to react (client-side) to manipulate/display.I've seen this redux example,http://ift.tt/2shb69t I'm wondering if there is a way to achieve this w/o the use of redux/state?Maybe a boilerplate already exists that has solved this?

Submitted June 12, 2017 at 11:44PM by sayurichick

Struggling to understand callbacks?

I've recently started learning Node.js and I'm struggling to understand callbacks and implementing them.I have a basic knowledge of programming in HTML, CSS and Python. Node caught my eye and now I've started learning it.Is it normal for beginners to struggle with this?

Submitted June 12, 2017 at 11:06PM by holocene7

React + Express + Socket.io trouble: "No 'Access-Control-Allow-Origin' header is present on the requested resource."

So I used create-react-app to bootstrap my react project, then I added a small express server. The react app is running on port 3000 and the express app is running on 3001. Thus I set up my socket.io client like this (to be able to listen to the server):const socket = io.connect("http://localhost:3001"); class App extends Component { componentDidMount() { fetch('/api') .then(res => console.log(JSON.stringify(res.json))); socket.on('server-connect', function (data) { console.log('SHOULD RECEIVE A SERVER EVENT:'); console.log(data); socket.emit('client-connect', { connectedToClient: 'true' }); }); }However when it tries to receive data, I get this error: "XMLHttpRequest cannot load http://localhost:3001/socket.io/?EIO=3&transport=polling&t=LoT-cfW. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404."So then I went into my app and added this, but nothing is working still:app.use(function (req, res, next) { const origin = req.get('origin'); res.header('Access-Control-Allow-Origin', origin); res.header('Access-Control-Allow-Credentials', true); res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization, Cache-Control, Pragma'); // intercept OPTIONS method if (req.method === 'OPTIONS') { res.sendStatus(204); } else { console.log(origin); next(); } } );No clue what to do.

Submitted June 12, 2017 at 09:25PM by tangerto

[HELP] matchID from npm csgo

Can someone help me with script to grab current matchID using requestLiveGameForUser? I found script for that, but something need to be changed, I don't know what exactly Script: http://ift.tt/2s3IoXD I want paste steamID64 and I want to see only his current matchID. Should works like: steamID = readlineSync.question("SteamID64: "), I can pay for that.

Submitted June 12, 2017 at 08:22PM by oklaski

[Help] How to proxy an https website through a local node server? (like Charles Proxy does it)

For those not familiar with Charles - basically, it enables you to troubleshoot by intercepting https requests from deployed websites.I wish to achieve something similar in node, for automating some of the troubleshooting.It was a breeze to set it for http, but when trying to proxy https, Chrome throws either EMPTY_RESPONSE or PROXY_CONNECTION_FAILED errors.//importing + boilerplate app.get('*', (req, res) => { // works on http, nothing happens on https console.log('req', req); res.send('hello world'); }); httpServer.listen(8080); httpsServer.listen(8443);

Submitted June 12, 2017 at 07:56PM by GoosyTS

Course on building your own CI pipeline from scratch

http://ift.tt/2qZTfV9

Submitted June 12, 2017 at 07:37PM by danny_nav

How to Use Twilio Functions for Serverless Node.js Apps

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

Submitted June 12, 2017 at 07:05PM by brentschooley

JavaScript Standard Style

https://standardjs.com/

Submitted June 12, 2017 at 06:43PM by Saltones

MiniShift as a Developer Environment for Node.js on OpenShift / Kubernetes

http://ift.tt/2s22fGU

Submitted June 12, 2017 at 03:55PM by vertice

[QUESTION] Is my API routing logic bad?

Hi! Building my first non-trivial express api to be consumed by an Angular2 app. I'm having a real hard time with modelling. I want to use mysql, not mongo, so I'm also having trouble finding good tutorials.Basically, my logic is as follows:api/users.jsrouter.get('/',function(req,res){ pool.getConnection(function(err,connection){ if(err) return res.json(err); else { connection.query("select id,name,privilege,max,holding,max_visiting,visiting from users",function(err,rows){ //GET ALL USERS if(err) return res.json(err); else return res.json(rows); (...) I know this is not standard. From what I understand, best practice is to have a class "User" declared somewhere, with methods that will access the database and return the content. On the routing page, I'll just have to create an instance of that class, call the method and return the results.What I don't understand is WHY that is best practice. It justs seems a lot more code for no good reason. Am I missing something here? Is my code that bad? Thanks!

Submitted June 12, 2017 at 04:04PM by fariswyatt

How to get, use, and close a DB connection using various async patterns in Node.js

http://ift.tt/2sf7Zz4

Submitted June 12, 2017 at 03:10PM by dmcghan

Node.js Tutorial to upload an image to the Server With Multer

http://ift.tt/2sTqoPA

Submitted June 12, 2017 at 12:13PM by impuneet

Coding with nodejs is so confusing...

I need help with TCP/IP servers

Hi, I'm in high school and learning Node.js from FreeCodeCamp. It uses the node school tutorial. I'm having trouble with lesson 10 (Time Server). I don't understand all the TCP/IP, socket jargon. I've used HTTP servers before, but I have no idea what this is. Please give me some tutorials that will help.

Submitted June 12, 2017 at 07:44AM by jimmypixel

Continuous Deployment with Node.js, DynamoDB, AWS Elastic Beanstalk and CircleCI

http://ift.tt/2rY6Agm

Submitted June 12, 2017 at 08:06AM by katerina-ser60

How to get a daily digest from remoteok.io straight to your inbox with Node.js

http://ift.tt/2tbDxTI

Submitted June 12, 2017 at 09:16AM by GitW_85

A realtime, decentralized, offline-first, graph database engine.

http://ift.tt/1qokG58

Submitted June 12, 2017 at 07:21AM by ratancs

Sunday 11 June 2017

What are some medium-sized Express projects that people can learn from?

Want to look at how people structure their project and business logic.

Submitted June 12, 2017 at 05:01AM by __Warden

Automatically import Angular 1.x directive templates with webpack without code changes

http://ift.tt/2rlycI7

Submitted June 12, 2017 at 03:05AM by YashdalfTheGray

What the "wordpress" of node.js web applications?

What are people usually using when they are looking for an equivalent?

Submitted June 12, 2017 at 02:53AM by ZhangNoWei

who would like to collaborate on a project?

Ive started a project that is basically a google drive clone and I would like to know if anyone wants to collaborate on it with me.

Submitted June 11, 2017 at 08:44PM by JackAppDev

Appropriate use case for Node.js?

I'm a complete beginner to Node and even though I don't think I really understand it I would like to build a simple app to gather some knowledge.I would like to build an app that just includes 1 button and 1 paragraph. When someone clicks the button the paragraph will simply say "someone clicked the button" for 1 second and be visible for everyone visiting the site.Now, if I have correctly understood node then this is possible and appropriate use for node?Thanks for any info!

Submitted June 11, 2017 at 04:04PM by GramatikClanen

Using Node to implement a server file into a webpage.

I want to store 3 csv files into my server side so that when a client selects a specific link the page is reloaded and the page is rebuilt using info in these files.Currently just trying to log the file to the browser console using the code below but get the error "Uncaught TypeError: fs.readFile is not a function"/* File System Object */var fs = require('fs');/* Read File */fs.readFile('foo.json', bar)function bar (err, data) {/* If an error exists, show it, otherwise show the file */err ? Function("error","throw error")(err) : console.log(JSON.stringify(data) );};

Submitted June 11, 2017 at 03:18PM by Coniix

Running tests for .NET and Node.js on Travis CI

http://ift.tt/2re4R7j

Submitted June 11, 2017 at 08:24AM by WPMusicFinder

Saturday 10 June 2017

Need help with a simple question

I need to spar TXT data into a sheet, and then through the operator if I check its presence in the sheet, I just started to study this YAP and I do not know how to implement it :(Skinte me just links to the documentation that will help me or give the ready code please

Submitted June 11, 2017 at 05:22AM by maratmkhitaryan

Spawning 10-15 child processes?

I have a module that I'd like to run multiple instances to query different urls and process data as fast as possible. The server/api has a limit of 10 connections so I can't exceed that but when I run this code it may need to query as many as 25 urls. What is the best way to handle this on a server with 2 cores?I've looked into child processes but I'm not sure if this is the best way forward. Should I spawn 10 child processes and the 2-core server will figure out how to juggle them? Should I only spawn 2 child processes that each can handle 5 connections at a time and then write code that feeds each process a new url to query when it completes one of its existing url queries?Or, are both of my ideas garbage and I'm insulting the wonderful world of node? :D I am but a lowly designer that enjoys messing with node in my free time. Thanks!

Submitted June 11, 2017 at 03:36AM by yourfavorite

Node.js Discord Server

Hello! I have decided to create a Discord Server for the Node.js community. What is Discord? Discord is like IRC, TS3, and Skype, all in one. It has a full-fledged API in Node.js, and is great for communities. Click here to join: http://ift.tt/2t6OtSk Note that this post has been approved by (at least one) of the mods.

Submitted June 10, 2017 at 07:49PM by SciencyScience3953

IDE for MAC

Hi All, I am new in node.js development, I am coming ffrom .NET world, so I used to work with the great visual studio. Now I am looking for the best IDE that I can get with great debugging options (the vs debugging is great). Thanks!

Submitted June 10, 2017 at 03:29PM by cohenal

Good guides on learning Meteor?

No text found

Submitted June 10, 2017 at 03:50PM by OzziePeck

Are there any example benchmark projects one can download?

I'll be testing out a few new machines soon and would prefer not to have to spend time setting up our app on each one each set up takes quite some time. Something that I can just simply download and run with minimal config would be nice.Ideal set up experience:git clone npm i npm start

Submitted June 10, 2017 at 11:05AM by AdventurerSen

Publishing a Maintainable NPM Module with Continuous Integration

http://ift.tt/2rgrJjo

Submitted June 10, 2017 at 11:09AM by r-wabbit

Developing A Chatbot Using Microsoft's Bot Framework, LUIS And Node.js (Part 1)

http://ift.tt/2qxddlT

Submitted June 10, 2017 at 11:01AM by ginger-julia

Some useful websites for programmers.

http://ift.tt/2nkFf5J

Submitted June 10, 2017 at 07:54AM by ratancs

Friday 9 June 2017

Has anybody figured out how to debug node apps started with --inspect=PORT in Webstorm?

The node process reports something like this:Debugger listening on ws://127.0.0.1:9230/253da985-50b9-4450-a857-be89ffa7ffc7 In Webstorm, the remote debug configuration only allows for a host and a port, and is missing a place for the hash. The other problem is every time I restart the node process, even though I've specified --inspect=9230, it grabs the next available port (9231, then 9232 etc).

Submitted June 10, 2017 at 05:40AM by mrjking

Blocking POSIX semaphores for Node.js

http://ift.tt/2scMUGe

Submitted June 10, 2017 at 01:02AM by dbousque

Issue using POST on form with Node.js

So I've been given the job of taking the source code for thoughworks technology radar and editing it to take in a local CSV file as opposed to a Google sheet.My problem is while doing this I've wanted to change their form for submitting the sheet URL to use a POST instead of a GET request but when doing this I get the error Cannot POST /I'm wondering if in a config file for Node.js is it possible to block POST requests altogether? I've tried implementing some code to listen for POSTs but to no availI've also tried to skip the form altogether and host the files on the server and use fs to read and parse the files but fs didn't install on my work machine despite it being a core module and network security is so tight I can't download it using npm install fs.

Submitted June 09, 2017 at 10:46PM by Coniix

When do I have to resize? (Video)

In my application, users allow to upload their video but it need to be approved first before other can watch it. It's also possible that it will be rejected. So I have to resize video that is super high quality eg. 720p++ to either 480p or 720p to make it smoother for mobile user. When should I resize a video? 1.) resize after they upload, don't care whether it's approved or rejected 2.) resize after video get approved Shoot me some idea guys.

Submitted June 09, 2017 at 04:50PM by thestrayed

Node.js Fs issues.

Can the NodeJS File system be “refreshed”, if I delete a folder I’m using for temporary download storage, run the code, it fails because it can’t locate the two downloaded files, but they exist?

Submitted June 09, 2017 at 04:01PM by AlexLex1500

The Ultimate Node Tool for about 50% of /r/node's submissions

http://ift.tt/1rkM1U4

Submitted June 09, 2017 at 04:09PM by pikadrew

i feel like i'm super close...

So i have two files script.js and app.js I'd like to log some message using my custom express middleware... I've been trying to solve this for the past 6 hours...Any help would be greatly appreciated//script.js (containing the portion of code i'm triggering from the front end)const router = express.Router();router.post('/myroute',(req, res, next) => {//doing somethingres.json({success: true, content: someObject});});//app.js ( containing the middleware portion limited to '/myroute')const app = express();app.use('/myroute', function(req, res, next) {console.log ("inside middleware why you no show up?");next();});

Submitted June 09, 2017 at 03:28PM by DepressedHypeman

The Ultimate Node Tool for about 50% of /r/node's submissions

http://ift.tt/1jBnDYz

Submitted June 09, 2017 at 03:37PM by pikadrew

Why is python used for cryptography much more then javascript/node.js/other javascript frameworks. Is it because the actual python language is superior for crypto or is it because python has had a crypto community for longer so more people continue to choose python.

Why is python used for cryptography much more then javascript/node.js/other javascript frameworks. Is it because the actual python language is superior for crypto or is it because python has had a crypto community for longer so more people continue to choose python. Would be nice to know the reason for differing levels of use between the languages. Also now when javascript branches out into so many different things and is constantly making new frameworks do you think a new crypto framework is just around the corner?

Submitted June 09, 2017 at 02:18PM by smoothzzr

TypeScript Library Starter: universal bundles, automatic releases, out-of-the-box configurated, RollupJS, Prettier...

http://ift.tt/2m3zr0u

Submitted June 09, 2017 at 12:48PM by AlexJoverM

I'm loving Node, thanks /r/Node

I've been working on Node for the past month, been having a lot of fun. I come from primarily a Django/Python backend (& PHP).Just wanted to say I appreciate everyone here helping me learn and not downvoting me to oblivion.Some of my beginner threads:Is NodeJS even right for me?What are some common/noob mistakes you find with JS/NodeJS developmentNode/MongoDB a must?Struggling to transition to Node, noob questionsI haven't made anything incredible, but I feel like I am working in the environment now - and not having to google every second. I love the unopinionated and lightweight feel (of Node in general & ExpressJS), I thought I wouldn't coming from Django! I'm not sure why, but I am in love with the template processing system Jade/Pug for Express - I honestly didn't know things like that existed even for other platforms. I've managed to reduce a ton of my code!Sorry to ramble!

Submitted June 09, 2017 at 01:37PM by Miles360x

How to use typescript with node

http://ift.tt/2rcTd7L

Submitted June 09, 2017 at 12:35PM by ogundipes

Just starting to learn programming and have a goal of working in the blockchain technology sector, is javascript/node.js ok for cryptography?

No text found

Submitted June 09, 2017 at 11:04AM by smoothzzr

Whats new for streams in Node 8 – Calvin Metcalf

http://ift.tt/2srjikD

Submitted June 09, 2017 at 10:48AM by katerina-ser60

Node.js Weekly Update - 9 June, 2017

http://ift.tt/2r1F7XK

Submitted June 09, 2017 at 10:15AM by hfeeri

NodeJS Windows Hello API (fingerprint sensor)

Hey there!I am currently looking to implement Windows Hello functionality for a purely private project of mine.Basically, what I want is to be notified when the fingerprint sensor in my laptop is successfully used. Maybe even some unique data from it, but that's not necessarily needed.Now, I have looked around, but it is really difficult to find anything for this (think about what you would find using node, windows and hello...). But it seems like there is nothing like this yet out there, and I would have to create it myself using the new native API.TL;DR: Does anyone know a library which enables me to use the fingerprint sensor in Windows 10 devices or will I have to write it myself?

Submitted June 09, 2017 at 07:23AM by Jake_Jeremy

Thursday 8 June 2017

What's New in Mongoose 4.10: The runSettersOnQuery Option

http://ift.tt/2rRf8U7

Submitted June 08, 2017 at 10:56PM by code_barbarian

Node.js Child Processes: Everything you need to know

http://ift.tt/2sYTFrA

Submitted June 08, 2017 at 09:17PM by samerbuna

Scrape Google search results using Phobetor and Nightmare.js

http://ift.tt/2rbk18s

Submitted June 08, 2017 at 10:02PM by self_refactor

Wes Bos' LearnNode - $270 total, $27 with 9 people • r/groupdeals - A few spots still open

http://ift.tt/2raLYxi

Submitted June 08, 2017 at 10:02PM by akatsuki5

JavaScript’s new #private class fields

http://ift.tt/2s4T23b

Submitted June 08, 2017 at 08:38PM by Power_153

How much overhead Swagger (npm) adds to Express, Connect and Restify servers

http://ift.tt/2s12bsI

Submitted June 08, 2017 at 07:53PM by assaflavie

Discovering GraphQL: E-commerce integration using Node

http://ift.tt/2rFnnEi

Submitted June 08, 2017 at 08:01PM by Tiewrap24

Learning Node

Hi everyone, I am software developer that has been tasked with learning node. I wanted to know what you guys think would be a good place to start. A little back ground. I do have very little knowledge of JavaScript. I use it sometimes, I understand it (Kinda), but I do not use it very much. Any help would be awesome! Thanks!

Submitted June 08, 2017 at 03:34PM by laroyster

N|Solid 2.2 Lands with More Metrics and Effortless StatsD Integrations

http://ift.tt/2rZpF1r

Submitted June 08, 2017 at 03:31PM by _bit

Node v8.1.0 released

http://ift.tt/2r5qdUm

Submitted June 08, 2017 at 03:23PM by mmaksimovic

N-API: Next generation Node.js APIs for native modules

http://ift.tt/2qAxwD9

Submitted June 08, 2017 at 10:14AM by harlampi

Moleculer, a modern microservices framework for NodeJS

http://ift.tt/2rOzX28

Submitted June 08, 2017 at 09:52AM by bobcsi

Wednesday 7 June 2017

Coren: React Pluggable Serverside Render

http://ift.tt/2rXurMW

Submitted June 08, 2017 at 05:12AM by williamy3y3

Getting started with Node.js - writing "Hello World". If you find these tutorials useful, please sign up, follow and ask questions.

http://ift.tt/2s5VnLw

Submitted June 08, 2017 at 03:18AM by Mikhail-Kotykhov

The JavaScript Engineer Skill Tree

http://ift.tt/2rWZsQY

Submitted June 07, 2017 at 11:01PM by hobonumber1

Alternative to node timers

I am developing a game made up of several boards where each board features a timer.That timer keeps track of the maximum time an user has to perform an action but if ALL the users perform the given action before the time expires then it should be restarted in order to start a new round.Well, I was thinking of creating a timer on server side like for instance a setTimout for each board and store it in an array so that I can cancel it on demand but that way I will have as many timers in memory as the number of boards.My concern is basically related to scalability, if the number of boards go up insanely then I might face some memory problems.All in all, I really would like to know what alternatives can you think of for this scenario that are more "memory-friendly" and scalable as well? For instance, how would you handle this challenge in a language that has no built-in timers?

Submitted June 07, 2017 at 08:51PM by utxeee

Question: how to read a file with fs then execute a function inside it?

No text found

Submitted June 07, 2017 at 09:59PM by draad

Everything you need to know about node docker images

http://ift.tt/2lyuXKG

Submitted June 07, 2017 at 09:56PM by Kailuaboys

Integrating Node.js Build Tools with Maven

http://ift.tt/2sgz5Go

Submitted June 07, 2017 at 07:17PM by Ramirond

MongoDB transactions - Javascript

http://ift.tt/2sEdUeI

Submitted June 07, 2017 at 06:33PM by e-oj

What is N-API in Nodejs 8

http://ift.tt/2sTSFF3

Submitted June 07, 2017 at 06:53PM by shsh3

Any downsides to using Node and Sqlite?

I'm just learning Node and Express right now. I have a lot of experience with Sqlite as a tiny backend database.Googling has shown a few sqlite/node libraries, but has anyone found any downsides to using it as a data store?

Submitted June 07, 2017 at 04:59PM by evildonald

How to write a Chrome extension

http://ift.tt/2szFPwj

Submitted June 07, 2017 at 03:24PM by AwsmIam

Replicate MongoDB into SQL

This is tangential to Node but since a lot of you are using MongoDB, thought I'd ask. I'm looking for a solution to keep a copy of a hosted MongoDB in SQL for BI analysis purposes. In terms of features:hosted is a huge plus, I don't really want to set up a server and process to handle this, happy to payMSSQL would be a win but I'm flexibleReal time is NOT a requirement, though architecturally it would probably make sense to update continuously in order to keep load downWould be nice if the SQL Schema was automatically updated but that's not essentialI am aware of MoSQL but it only sorta checks all the boxes and there doesn't seem to be a hosted solution. I would have thought this requirement would be less niche than it appears to be.

Submitted June 07, 2017 at 03:40PM by user59873

[question] What modules do you use to build user/login functionalities with?

I am working on a project and recently decided to implement a user functionality. I was curious what modules or packages are generally used to do this with. I have discovered passport js and got told that this is 'the way to go', what are the other options? Or should I just settle with passport js?Thanks in advance.

Submitted June 07, 2017 at 02:59PM by inochy

Last Week in Node.js Working Groups - May 29, 2017

http://ift.tt/2s42pAn

Submitted June 07, 2017 at 03:03PM by _bit

util.promisify() in Node.js v8

http://ift.tt/2rAHcfC

Submitted June 07, 2017 at 01:31PM by zeal_kaiser

How to Send 10,000 calls to Congress with Node.js and Twilio

http://ift.tt/2r1uKqD

Submitted June 07, 2017 at 12:30PM by makaimc

[question] How to deal with a routes.js that grows too large to be easily maintained?

I'm using node and express to create a rest api. I followed a tutorial where all the routes and its logic are saved in a routes.js file like this:SERVER JS:var express = require('express'); var app = express(); (...) require('./app/routes.js')(app, port, express); ROUTES.JSmodule.exports = function(app, port, express) { var apiRoutes = express.Router(); (...) //Sample route apiRoutes.get('/userfiles', function(req, res) { UserFile.find({ owner: req.decoded.user.email }, function(err, filesList) { if (err) return done(err); res.json({ success: true, files: filesList }); }); }); My problem is twofold:1 - Routes can easily contain code thats 150 lines long, some of them far longer. It doesn't feel clean to have route declarations and the logic grouped together. Is it a good practice to do something like this instead?apiRoutes.post('/randomRoute', function(req, res) { return res.json(functionThatContainsTheActualCode(req)); }); (and then have an functionThatContainsTheActualCode function with all the logic in a different file).2 - I have middleware that applies to some functions (for example, some routes are only accessible for logged in users and those routes go through an authentication middleware). Currently way I do it is declaring public routes before the middleware declaration and private routes after, which feels incredibly hacky. How can I separate public and private routes (and the middleware itself) in different files?

Submitted June 07, 2017 at 11:55AM by kace91

StdLib Now Supports Node 8.0.0 + new "FaaSlang" Function Definitions

http://ift.tt/2s3g0rt

Submitted June 07, 2017 at 10:15AM by keithwhor

What to learn if I want to make me my node app gets json data as soon as they are available ?

Say I post a new blog post, I want the app to automatically get the new JSON data as soon as the post is up.I thought of using settimeout() to make it keep rechecking but is there a better way ?

Submitted June 07, 2017 at 09:19AM by sohaeb

Nock doesn't work on Node.js 8. I put this local test server together for my needs. Thought some people here may find it useful.

http://ift.tt/2qNXUcG

Submitted June 07, 2017 at 06:55AM by dyslexiccoder

Create a custom Slack slash command with Node.js and Express

http://ift.tt/2qPUu7O

Submitted June 07, 2017 at 07:35AM by katerina-ser60

NodeJS Application with Express – Handlebars and Mongoose

http://ift.tt/2qVLUls

Submitted June 07, 2017 at 08:20AM by addtej

Tuesday 6 June 2017

Basic Node.js debugging in Google Chrome

http://ift.tt/2s1JRk6

Submitted June 07, 2017 at 12:04AM by CodyReichert

How to Build a Facebook Bot App Using Node.js – Hacker Noon

http://ift.tt/2qYPpfh

Submitted June 06, 2017 at 10:40PM by pmz

Testing data access layers

What are considered the best practices for testing data access layers in node?For background - I've started a new project using node, with a database using postgres and the pg module for data access. Nice and simple, but I'm struggling with the testing side of it.I've come across the pgmock library which works well enough, but does nothing to prove that the SQL is correct.Is there any considered best ways to achieve this short of full stack acceptance tests?

Submitted June 06, 2017 at 08:42PM by sazzer

Which back-end framework in 2017?

What's the consensus regarding back-end frameworks these days? Stick with Express, switch to Koa, or use something else entirely.Also, if I'm using Angular, Vue, or React how much will I be relying on the back-end vs front-end for routing, etc...?

Submitted June 06, 2017 at 06:26PM by botchlings

Strategies for Propagating Document Updates

I was once on a team fully on the MEAN stack. Our job was to write full-stack code from the database, server, and front-end and crush lots of story points! Things went well until our models became very complex, and the Node <-> MongoDB relationship started to get hairy. One particular problem was propagating updates. When I talk about propagating updates, I mean I have document/record A that document/record B depends on. When I make an update to A, B also needs to update. Keep in mind, the API was technically the arbiter to the database, so any and all updates on the model were through the server. Now, with that, we could have easily just, on a request to update document A, also fetch document B and make the update. Some questions get raise when you need to send a response to the client, but in any case it's a simple thing to not only implement, but test. Everything is serial and after stubbing out functions, very deterministic.Instead of doing the simple thing with propagating updates and just promise chaining, someone decided before my time to implement an event bus. When a document is updated, it sends an event to the event bus, and all Models essentially have listeners that will correctly make the updates. The problem ended up being testing. Instead of using a fake event bus that just deterministically stores your listeners and you call them when you need it, we used... the real event bus.Enter nightmares.Tests randomly failed due to the tests not completing in time, because of course the stack must be cleared before popping off a callback in the queue. Each time, our only answer was, "Let's increase the timeout!" THINK ABOUT THIS. The event bus adds callbacks to the queue through libuv, and there's no guarantee when libuv will push to the stack, nor is there an order to it. A failing test will say, "I failed after 5 seconds," yet after increasing the timeout to 10 seconds, if a test runs and other async tests are added to the queue before pushing it back even further, it means you have to recommit pushing it back, again. This was probably the most annoying part of our jobs considering you would work on a feature, then Travis wouldn't ok the build because a test failed in a code chunk that wasn't even touched.Now in this case, what would you do? Sadly, I had no power to convince the devs to refactor because no one ever wants to add technical debt in a startup where features matter. In retrospect, this was over-engineering. EventEmitters have their place for multiple events. They are the dual to iterators. Here we have a single event (a user making an update) and when it's done, we want to call a single callback (updating the second document). I could see why we may want a stream of that, but it's arguably worse from a practical standpoint since we now have to test it using lots of timeouts. I think the only bonus to eventEmitters is that you can vertically scale since the events, and their updates are atomic, but even that would have required some refactoring of the event bus and at the time, it was actually all running single-threaded.So I ask, how do you handle propagating updates? What are your thoughts on avoiding EventEmitters until absolutely necessary? What are your thoughts on using EventEmitters in a multi-threaded environment?

Submitted June 06, 2017 at 06:02PM by umib0zu