Wednesday 30 November 2016

Deploying Node w/ Express App to DigitalOcean: App Won't Run On Port 3000

My Express app is on a Ubuntu 16.04 DigitalOcean server with Node installed.As a basic test I ran my server.js file with this command: node server.js Then I tested the file with: curl http://localhost:3000 however this returned Cannot GET /.I tested a separate app.js file without Express using a simple HTTP server and it returned anything I wanted regardless of port number. In other words, it isn't a firewall issue.Express module is installed.I think it may be a problem with my Express implementation. Here is my server.js:var express = require('express'); var app = express(); app.listen(3000, function () { console.log("express has started on port 3000"); }); Any advice on how else to troubleshoot this issue?

Submitted December 01, 2016 at 06:23AM by joWebDev

I bypassed a capcha + email verification with NodeJS!

http://ift.tt/2gJm5kh

Submitted November 30, 2016 at 07:04PM by deepsyx

mysqljs/mysql stream processing blocks event loop at the end

I have a problem with app execution hanging for 12 seconds after a mysql call. During that time event loop is blocked and other events (like heartbeat) are not processed, which causes app to disconect from rabbitmq.The app:I'm using mysqljs/mysql to fetch records from a local mysql database, process them and save to mongo. A simplified version is pasted below. I've replaced asynchronous mongo call with a dummy, and eventually removed it as it turned out setTimeout(() => connection.resume(), 1) reproduces the problem.main filereturn Q() .then(() => mysqlq.each(query, [customer_id])) .tap(() => console.log('after each')) mysqlq wrapperconst connection = mysql.createConnection(settings); this.each = (sql, values, cb) => new Promise((resolve, reject) => { let i = 0; connection.query(sql, values) .on('error', reject) .on('result', (row) => { connection.pause(); //actual processing is normally taking place here setTimeout(() => connection.resume(), 1); }) .on('end', () => { console.log('on end'); resolve(); console.log('after resolve'); }); }); The problem:For a query that returns about 130000 rows the application hangs between "after resolve" and "after each" for about 12 seconds (Shorter result sets don't have that problem). It doesn't process anything else, including heartbeats. I've even tried to send a signal to invoke heap dump, but it's not being processed during that time.[2016-11-30 17:05:30.171 UTC] [LOG] on end [2016-11-30 17:05:30.179 UTC] [LOG] after resolve [2016-11-30 17:05:42.281 UTC] [LOG] after each There's no delay when setTimeout(() => connection.resume(), 1); is replaced with connection.resume()[2016-11-30 17:01:45.390 UTC] [LOG] on end [2016-11-30 17:01:45.395 UTC] [LOG] after resolve [2016-11-30 17:01:45.395 UTC] [LOG] after each Heap size looks stable. GC tracking does not show any runs after "on end". Profiling showed that during that time _ZN2v88internal4Heap12MoveElementsEPNS0_10FixedArrayEiii was being executed (link to flame chart below).Does anyone have any idea what might be causing the problem?Flame chart from the last 20 seconds of execution: http://ift.tt/2gVUOOK'm using:Docker: 1.12.3Ubuntu: 14.04.5 LTSnode: v6.9.1mysql: 5.5.49mysqljs/mysql (node lib): 2.11.1

Submitted November 30, 2016 at 06:22PM by wtfisthiswitchery

Announcing NodeSource Certified Modules for Node.js

http://ift.tt/2fJ8mrR

Submitted November 30, 2016 at 04:14PM by _bit

Need someone to tutor in Node.

One of the best ways to master something is to teach it to someone else. Looking for people who need someone they can reach out to for advice and help with their node problems and let me come fix them.

Submitted November 30, 2016 at 04:56PM by TheMasterTech

Kubernetes CI/CD with Docker and Node

http://ift.tt/2gl2zMZ

Submitted November 30, 2016 at 05:33PM by devopsdj

Learn Node JS by building 5 real world apps. From total beginner to back-end developer!

http://ift.tt/2fLLyaA

Submitted November 30, 2016 at 03:49PM by Andrujoy

We’re donating the Node Security Project to the Node.js Foundation

http://ift.tt/2gkFppX

Submitted November 30, 2016 at 03:32PM by hfeeri

Mongoose returning an empty object?

I have a search api that you can search using the imgur api and it'll return json data of the images, but will also record your latest search in the "/latest" url. The only problem is it returns an empty object no matter what I do. Anyone know why this is?Whole file: http://ift.tt/2fDrfkJ code that may be not allowing it: index.js router.get("/latest", function (req, res) { History.find({}, 'term when -_id').sort('-when').limit(10).then(function (results) { res.json(results); }); }); router.get("/search/:q", function (req, res) { imgur.getImage(req.params.q, req.query.offset).then(function (ans) { new History({ term: req.params.q }).save(); res.json(ans); }); }); history.jsvar historySchema = new mongoose.Schema({ term: String, when: { type: Date, default: Date.now } }); var History = mongoose.model("History", historySchema);

Submitted November 30, 2016 at 03:07PM by jeff_64

Redis + Node.js: Introduction to Caching

http://ift.tt/2fQQG0A

Submitted November 30, 2016 at 03:09PM by hfeeri

Tuesday 29 November 2016

Typescript 2 Masterclass: Node REST API + Angular 2 Client

http://ift.tt/2gImGBu

Submitted November 30, 2016 at 07:49AM by calvin791

Faster alternative for moment-timezone

http://ift.tt/2gtx1Cm

Submitted November 30, 2016 at 07:04AM by iamfloatdrop

Need help on logging HTTP header with swagger-express-mw

Hi,I have this project that uses swagger-express-mw. It was coded by someone else and it is fairly large (ie: re-architecting the whole thing is not really an option).As it is expected swagger-express-mw, I have a swagger.yaml file that reference a bunch of controllers and methods.For instance, I may haveexports.myMethod123 = function (req, res) { // code... } exports.myMethod456 = function (req, res) { // some other code } Of course, each of these controller then call a service layer which use various DTO and DAO, etc.My question is: at various point in these services, DTOs, DAOs and other modules I want to log and trace a variable set by the Nginx front-end (X-RequestID)... how to do so?Usually, in the services or DAOs, the "req." object is long gone. We're several async calls deep and the initial context is totally lost. It might be worth noting that for logging we wrapped Winston. Therefore I would like, as much as possible, to use the Rewriter feature where I would dynamically inspect a "context" object and add info to the log if the "context" object contains something I want to log (X-RequestID).I've looked quite a lot on the Internet. Something called "domain" seemed promising, until I found it was deprecated. request-context seems nice too, but I would have to go through every controllers's methods (+200) and set the request-context everywhere.Anyone aware of a simpler method? I'm thinking of something like a HTTP interceptor: on every HTTP request, execute a function (which would perhaps set the request-context) and then the logger would be able to inspect this context.Any help on how to approach this problem is appreciated.

Submitted November 30, 2016 at 03:28AM by thisIsExactly20Chars

On Funding hapi.js Core Development

http://ift.tt/2fAG1c1

Submitted November 30, 2016 at 02:48AM by whitehatguy

Parsing/Converting big XLSX (over 600MB) to CSV

I've got a problem with converting big XLSX which is over 600mb to CSV. The thing is that with smaller files(>3MB) it's fine, but when it comes to big file then I can see how it eats up the whole memory and then just create an empty test.csv file. So far I used this module: node-xlsx I follow the guide here: http://ift.tt/2gGAsVf

Submitted November 29, 2016 at 09:33PM by When_The_Dank_Hits

Getting started with npm or Node.js package manager Techiediaries

http://ift.tt/2gtSFpJ

Submitted November 29, 2016 at 07:19PM by ahnerd

NIM - A Chrome plugin to automatically launch the debugger when using --inspect with Node 6+

http://ift.tt/2fz82ke

Submitted November 29, 2016 at 06:58PM by MostlyCarbonite

Node.JS: Is It Possible To Get The GTA V Wanted Level Programatically?

Trying to figure out how to get the number of stars (or even if the player is wanted) in a GTA V instance through Node.JS. I am considering taking a screenshot every so often and using this to analyse, but don't know where to start. Can anyone help?

Submitted November 29, 2016 at 06:23PM by ITCrowdFanboy

Problems finding an error.

I am new to node (and javascript), but not new to programming. I have been using node to make a twitch chat bot for a friend. I have things mostly working, but I am still getting two random error's and I can't seem to track them down.The two errors are:TypeError: Cannot read property 'status' of null ER_BAD_FIELD_ERROR: Unknown column 'undefined' in 'field list' I am at a loss because all of my code is in encompassed in try/catch blocks, the only thing catching the error is the following code:process.on('uncaughtException', (err) => { console.log('whoops!!! there was an error:' + err); }); I am guessing that the 2nd error is a DB error, but I am not sure why it would be happening. The errors happen at random as well. I received 2 of the 2nd error 4 minutes apart But didn't see another one for an hour. I can't seem to determine what is causing them, how or why it is happening.I am looking for some insight as to at least how to track down where they are happening.

Submitted November 29, 2016 at 05:03PM by azazael13

IBM, Intel, Microsoft, Mozilla and NodeSource Join Forces on Node.js

http://ift.tt/2fyMzYF

Submitted November 29, 2016 at 05:05PM by iends

Node.js Foundation Doubles Down on Node.js API, ChakraCore

http://ift.tt/2gFsoFM

Submitted November 29, 2016 at 04:29PM by iends

Generator based retry function for co and koa

http://ift.tt/2gFmRiw

Submitted November 29, 2016 at 03:40PM by blacksonic86

Building an API without Strongloop or Express

Hello, I am currently building an API, but I am having trouble learning it as all the online tutorials and examples use Express and/or strongloop. I need to find some useful learning materials that will help me build an API without the use of express or strongloop. Thanks

Submitted November 29, 2016 at 03:48PM by pavilionuk

Advise for learning Node?

I've been trying to use it on the api challenges at freecodecamp and just find it overwhelmingly confusing compared to any other language as of yet tried. Went through tutorials helping walk through the projects but with most of them done it still feels like jibberish besides starting a server with express which is pretty easy. Anyone know of a good place to learn Node?

Submitted November 29, 2016 at 03:49PM by jeff_64

A curious case of memory leak in a node.js app

http://ift.tt/2g1gmp5

Submitted November 29, 2016 at 12:44PM by xylempl

NodeJs & SimplePush.io

Hi everybody, I stumble across this SimplePush.io wich is perfect for a project of mine, so basically it works perfect via curl as stated on the website:~ $ curl 'http://ift.tt/2fLD1Yt easy' or~ $ curl --data 'key=HuxgBB&title=Wow&msg=So easy' http://ift.tt/2grJzdo So i'm trying to use it in my server-side application but I tried many nd many ways without success..So I was wondering if anyone out there could help me out to acomplish this with a bit of code. Many thanks in advance

Submitted November 29, 2016 at 09:15AM by Fabbio1984

stdlib Service Wizard - Build a Node.js Microservice from Your Browser

http://ift.tt/2g0nz8U

Submitted November 29, 2016 at 08:41AM by keithwhor

Sunday 27 November 2016

Things you may not have known about Node.js modules

http://ift.tt/2gmb2gj

Submitted November 28, 2016 at 03:30AM by thomas_stringer

Top 5 news( node.js ) application for Mac.

No text found

Submitted November 28, 2016 at 01:36AM by gideonairex

Tutorial: How to create a Telegram Bot with Node.js

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

Submitted November 27, 2016 at 10:02PM by n2try

Manage the integrated Node V8 inspector and Chrome DevTools

http://ift.tt/2fC73e5

Submitted November 27, 2016 at 08:23PM by alias_willsmith

How should i connect node with database

Im trying to make MMO game. Client will connect to node server etc. Problem is with database, I want to update database everytime user disconnected, and only way i can do it is with PHP and MySQL, question is: Is it secure ? Should i do it like that ? Is there any better way ?

Submitted November 27, 2016 at 04:58PM by dedaloodak

which framework would you recommend me for back-end?

For a quite a simple website-blog with some additional functionality. No need a framework for a front-end, only back-end.I think it's Express? Or Meteor? Or anything else? No

Submitted November 27, 2016 at 03:54PM by Sikabi

AOE attending Node Interactive in Austin this week?

Also it is my first conference. Any tips on what to wear/bring?

Submitted November 27, 2016 at 02:09PM by tomberenger

Saturday 26 November 2016

Are you still using forever to run your node apps? I wrote this handy guide showing you how to use systemd instead

http://ift.tt/2gLe6WV

Submitted November 27, 2016 at 03:24AM by dblaa

Need help/opinions for async DB saving convention and practice

Hey there good people, I have a question: Say I have a blog with an Article model and each article has a Category model which is in the DB. Then, the Category has an array of Articles that have that category. So a ManyToOne relationship.What is the correct way to save this into the database? Do Ia) Create the new Article, save the article to the category asynchronously and redirect to whatever I wantb) Create the new Article, save the article to the category, await the Promise that it has been saved and THEN redirect to whatever I want?I can see that b) makes more sense, but does that not go against the point of node.js's asynchronicity?

Submitted November 26, 2016 at 10:49PM by Netherblood

tls.connect() doesn't work on Mac

I'm connecting to an imap server usingtls.connect({ host: 'imap.domain.com', port: 993, tls: true }) And on Mac it returns an error: "unable to verify the first certificate" but running the exact same code on Windows works without any errors.

Submitted November 26, 2016 at 06:10PM by nodenoob123

JSON-Splora: GUI for editing, visualizing, and manipulating JSON data

http://ift.tt/2g0rntB

Submitted November 26, 2016 at 03:36PM by lepuma

Node process cpu suddenly reaches 100%

We have an application running on nodes v0.10.32 very old version. Actually it works fine, but the CPU percentage becomes 100% if the process running continuously for two weeks without any restart. I ran the top command to find out the problem, but I couldn't determine the cause of this issue.Top comman result:top - 18:08:29 up 229 days, 6:51, 4 users, load average: 2.52, 2.63, 2.38Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombieCpu(s): 4.0%us, 0.2%sy, 0.0%ni, 95.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stMem: 41256236k total, 40498968k used, 757268k free, 62168k buffersSwap: 14614512k total, 516404k used, 14098108k free, 23415636k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND99764 nodejs 20 0 2223m 1.4g 4372 R 101.8 3.6 869:52.26 node

Submitted November 26, 2016 at 02:37PM by karthik_tantam

Saker: The new template engine for Node.js and browsers.

http://ift.tt/2fjZugQ

Submitted November 26, 2016 at 12:30PM by eshengsky

tls.connect error: unable to verify the first certificate

Building a node.js application that use tls.connect but I can't get it to work. When I calltls.connect(options) it returns an error: unable to verify the first certificate.I've searched all over and no-one has an answer to this, some people say to include the lib ssl-root-cas which returns an array of certificates and put it in the options.ca parameter, but this still doesn't work. Any ideas?

Submitted November 26, 2016 at 11:51AM by nodenoob123

a Koa and Next.js inspired middleware for node

http://ift.tt/2gJxIus

Submitted November 26, 2016 at 11:18AM by thysultan

Friday 25 November 2016

Express w/ Mongoose: Can't increment beyond 5 or so increments

Essential functionality here is 1 click = 1 vote, it updates a vote parameter in MongoDB and it is incrementing within MongoDB just fine. However after about 5 votes it stops incrementing. When I refresh the browser it allows me 5 more increments then no more until the next refresh..Is there something I'm missing, perhaps pertaining to the 'findOneAndUpdate' method? I've tried just using the 'update' method and the behavior is the same. I've checked the docs and found no mention of a '$inc' increment/time/interval limit. Here is my server.js: var express = require('express'); var mongoose = require('mongoose'); var Schema = mongoose.Schema; var bodyParser = require('body-parser'); var app = express(); mongoose.connect('mongodb://localhost:27017/food'); //Allow all requests from all domains & localhost app.all('/*', function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Accept"); res.header("Access-Control-Allow-Methods", "POST, GET"); next(); }); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); var usersSchema = new Schema({ id: String, vote: Number }); var bkyes = mongoose.model('bkyes', usersSchema); app.get('/bkyes', function(req, res) { bkyes.find({}, function(err, bkyes) { res.send(bkyes); }); }); app.post('/bkyes', function(req, res, next) { bkyes.findOneAndUpdate({$inc: { vote: 1 }}) .exec(function(err, foundObject) { if (err) { console.log(err); }}); }); app.listen(3000);

Submitted November 26, 2016 at 05:25AM by joWebDev

Timestamp API Project - A Javascript/Nodejs Beginner to Intermediate Project

http://ift.tt/2gvFPrN

Submitted November 26, 2016 at 05:42AM by R4meau

Crash Algorithm help

If you've seen a CS:GO gambling site, then it might have the mini-game "Crash". There is a counter that goes up, but it increments by 0.01 each count. The counter speeds up exponentially, so it might take around 3 seconds to get 1.2 (the counter starts out at 1), and speeds up. My problem is I need an algorithm that can calculate the speed that the counter needs to go at each loop. The data I can supply the algorithm is an integer. Also, the algorithm needs to work with a server-side count, that sends a socket request that says "round end/round start". They need to line up, so that if the round ends at say, 3.24, then the client will have 3.24, or something very close. I pre-define the number it will count up to using my own algorithm. The code for client side: setInterval(function() { count +1 0.01; },[time algorithm here (ms)]); And the client side will have a setTimeout. All I need is an algorithm that calculates how long it will take for the round to end.

Submitted November 26, 2016 at 06:10AM by bluebird173

Koa style middleware layer for your own projects

http://ift.tt/2fOBoXC

Submitted November 26, 2016 at 07:05AM by andycharles

Create a Simple Twitter Bot with Node.js

http://ift.tt/2gqpEuh

Submitted November 26, 2016 at 04:38AM by nodemonutil

Quick question about importing and class hierarchy

Hi, quick question about importing dependent modules into "base" models, say I have a room module/class, and I have two teams per room.Would I import my team module into the room module and "new up" the teams within the room class?If this isn't the right place to ask just let me know!

Submitted November 25, 2016 at 10:03PM by Kiacarssuck

What are the potential issues when using a API located in Europe from Central USA?

I am about to start a project which we can use a service to do some complex work. The only issue is the server is located in Germany. I tried searching for this but came up with no results.Could I see major performance issues interacting with a API that is so far away?

Submitted November 25, 2016 at 06:35PM by Iron_Kidd

Announcing Node.js 6 LTS and Go 1.7 Support for Amazon Linux

http://ift.tt/2gbAdSF

Submitted November 25, 2016 at 11:17AM by lambda_linux

Node.js Weekly Update - 25 Nov, 2016

http://ift.tt/2fYUq0i

Submitted November 25, 2016 at 10:50AM by hfeeri

The step-by-step guide to making a multi-client chat with Ionic Framework and NodeJS. Code is available on GitHub.

http://ift.tt/2fAH4HI

Submitted November 25, 2016 at 09:01AM by elf_crg

Thursday 24 November 2016

MEAN Stack TDD

Are there any resources outlining the process of a TDD framework on a mean stack? To my knowledge, The backend and front end have to be tested separately with separate tools. I'm trying to delve into this but if someone could give me a quick pointer on which test suite to use for which end it would be greatly appreciated

Submitted November 25, 2016 at 05:23AM by JacobPariseau

Send daily emails with all child records created that day using node.js and firebase

Hello,I have a Firebase app with an iOS fronted that allows users to add sort of "To Do's". At the end of the day, I want to send each user an email containing all of the "To-Do's" they added. It looks like I need to use a CRON job on a node.js server which is what I have just set up. Now I need to,-get the users email and all of "today's" records -send them a simple email containing those records -use cron to do that every 24 hoursThis is my first node project although I've played around with django in the past, I am new to this. In terms of getting my server to talk to Firebase, and sending the emails, can anyone recommend any frameworks or steps to do this? I know this is a bit broad, but anything will help. Thank you!

Submitted November 25, 2016 at 03:56AM by ThisIsMyRedditNane

How to make a command line tool using Node?

I am learning Node.js and I discovered that npm was written in it, so I decided to test making a command line tool too, just for the sake of learning. But I don't understand how was npm made using Node. I know that if you want to get arguments in a Node program you can just use the process.argv array. But how can I make a program that is available to be called in any folder without using npm, that can be used just by typing the name of the program?

Submitted November 24, 2016 at 07:17PM by Takegi

Why Node JS is so much faster?

http://ift.tt/2g8SujO

Submitted November 24, 2016 at 06:47PM by webcheerz

how to async (non-block) a nodejs function?

I wanted to test some logical things out, before i do a big project in nodejs, and was wondering what is the way to "async" a function.Essentially, suppose i have an api "/getPosts" that might take 2 mins to return data per call...what I am seeing is when 2 calls are sent to /getPosts, the 2nd one will wait until first is resolved.now i know most DB drivers like mongoose, and http libs uses promises to alleviate this...db.get('table').then(function() {});but how does a developer use promises within their code?here is a sample i came up with (widely exaggerated, but illustrates the point)//not really async...but needs to be..ish function asyncFunc() { var stall = 100 * 10000 * 1000 * 10; for(var i = 0; i < stall; i ++) { } } router.get('/', function(req, res, next) { var startDate = new Date(); var xorig = x; if(x === 0) { x = x+1; asyncFunc(); } var endDate = new Date(); var seconds = (endDate.getTime() - startDate.getTime()) / 1000; res.send(' X is : '+ xorig + ' took: '+ seconds.toString()); }); the objective of above is to essentially have 1st request go through the for loop (suppose the user has 1M posts) while the 2nd request is near instant (2nd user has no posts)What i am seeing is that the first request hangs up the process until its done with for loop, then the 2nd request finishes.(on my comp, 1st one takes about ~12secs, next one "theoretically" 0, but in reality 12+X secs)so how do i Async the for loop? such that, 1st user waits until for loop is finished, whereas 2nd user doesnt suffer from delay?

Submitted November 24, 2016 at 04:27PM by T-rex_with_a_gun

nodejs noob server setup

Hello. So many years ago I used to be a php+mysql developer, but I gave up and did something else.... But recently I stumbled across node.js, npm, and express etc, and I liked what I saw, and decided to have a go and create a small app.The app works fine, and now I want to get into it more. However a friend who admitted he doesn't know anything about node.js, told me running node directly on a laptop was dangerous, because packages may contain malicious code. He said I should segrate apps into their own environment which would make deployment easier.So, I decided to buy a rpi to setup a small development server, but I'd like it to be production ready, so if I wanted to put it online I could. Now back in the day I used a single vps, with webmin, apache, php, mysql, bind installed, and from that one server I'd run many websites etc.The rpi hasn't arrived yet, so i'm trying to get started inside a vm, but I'm confused about what I need. I don't want to run one node app on the rpi. Ideally I'd like to run many node apps, and also have the ability to run other stuff like php, mysql, python etc.....Now I've been reading about docker, which makes sense, but I've read conflicting setups. Some people say you should segregate every service, so I assume I would have to install node.js, mongo, mysql etc all into separate containers? But other people have installed linux, nodejs, etc together inside a single container....So, I'm confused about what to do next, and I hope someone here understood what I wrote. Any help appreciated. Thanks

Submitted November 24, 2016 at 03:11PM by loucostello1

Moving from a monolith (django) to express, what do I need to know?

have a new project I'm working on and I'm expecting the project to be a decent size in both functionality and user size.Most of the design is going to revolve around creating the backend as an API, and calling it from a JS front end. It should perform lots of CRUD operations, some streaming, and live messaging.I've used Django & DRF plenty, and I've also used flask, and express a little bit. I'm considering going with a smaller framework like flask/falcon/express (maybe Go) to develop the API, but I've never made anything of significant size in any of them.The prime benefits (in my eyes) being performance, isomorphic JS (for node obv) and overall simplicity/maintenance.So I'm wondering if anyone can comment on the difference in time and difficulty of implementation using a non-monolith framework??I'm open to the microservices approach of building things. Please feel free to suggest tools/packages!TL;DR: I want to know how different/difficult it would be to implement a medium to large scale site from scratch in a smaller microframework vs a monolith. Implementation time being the biggest wonde

Submitted November 24, 2016 at 08:47AM by satchelf

Wednesday 23 November 2016

gfork: Fork/clone Github projects of npm modules

http://ift.tt/2fsvuxE

Submitted November 24, 2016 at 03:48AM by laggingreflex

Promise this'll be the last time I post here. If anyone can help CMV finish its DeltaBot, that'd be amazing!

http://ift.tt/2g8PkAB

Submitted November 23, 2016 at 11:35PM by Snorrrlax

Alternatives for KeystoneJS?

I've been using keystone for my latest backend projects where I needed to create an API and where an admin UI would be handy for the client to edit things. However, I've gotten stuck multiple times getting basic things like CORS or lists in mongo schemas to work.I've looked around, but can't really find any alternatives so far. Another idea is to use keystone for the admin UI and express for my routes, but that just seems like more work for nothing.Thanks in advance for any suggestions!

Submitted November 23, 2016 at 10:54PM by Aurovik

best choice for service discovery in nodeJs?

Current Architecture AWS codedeply + docker + MEAN

Submitted November 23, 2016 at 06:51PM by ratancs

ES6 test data generator

http://ift.tt/2f7nsf9

Submitted November 23, 2016 at 07:04PM by markocen

What dashboard framework is best*?

best isworks with Ubuntu 16.04 / Node 4.2.6.easy to extend so it shows widgets (text/values/gauges) without having to do much GUI stuff.I just need to show a couple of lists (text/filenames) and an integer value or two.So far I tried to install/use:dashing-js (broken dependecies / compile error when installing using npm).darbio-dashing-js (also broken dependecies / compile error when installing using npm).mozaik (unable to make it work with extensions after following docs / no help from author).

Submitted November 23, 2016 at 07:05PM by still_angry

Async and try/catch

I had this weird situation today, I was coding some random stuff and i used async/await and i had a little weird thing (in that moment) so i made and async function with promises etc, I called the function with await surrounded by try/catch for the reject of the promise but i misspelled 1 variable name and when i executed the code i got the error on try/catch and i verified the promise code etc, added some console logs for errors but the code inside promise was good, i was like (where's the error...) didn't used the e.stack (dumb move), so how do you guys make to know if the error on that try/catch was from the await or another function next to await or one misspelled variable (without the e.stack), i think await should have own error catching cuz using try/catch on await is weird for me, what's your opinion ?

Submitted November 23, 2016 at 05:42PM by 3nvi

Themis 0.9.4 release

http://ift.tt/2frt6XS

Submitted November 23, 2016 at 05:32PM by marybory

Built a scrape/screenshot tool, thought it'd be nice to hear what you think about it, or suggest features to add.

http://ift.tt/2f6UQ5N

Submitted November 23, 2016 at 04:51PM by RevDneck

Sessions by Pusher - Watch recordings of top-notch talks from developer meetups.

http://ift.tt/2ghlUPq

Submitted November 23, 2016 at 04:56PM by bookercodes

Quick and Easy setup of ES6 in Node.js

http://ift.tt/2fRjl64

Submitted November 23, 2016 at 02:54PM by lirantal

PM2 doesn't persist terminal session

I'm running some processes under 2 different users. One of them is fine but the other shuts down the pm2 daemon when I exit the ssh terminal session I use to start it.I've only ever used SSH to start either instance of PM2 so it's odd that one persists and the other doesn't.Any help would be appreciated.

Submitted November 23, 2016 at 02:24PM by SimonTheEngineer

HyperDev is awesome and I do not work for them (It's from the creators of Trello, FogBugz, and [co-creators of] Stack Overflow) (Re-post because of conspiracy theorist downvotes)

http://ift.tt/1s6xUoO

Submitted November 23, 2016 at 01:58PM by hihij88

Node.js Tutorial Videos: Debugging, Async, Memory Leaks

http://ift.tt/2gk4M9K

Submitted November 23, 2016 at 01:27PM by hfeeri

How to make an HTTP request through OpenVPN?

We have some APIs that are only accessible through OpenVPN (for now it's 3 APIs in 3 different OpenVPN networks). How can I make an HTTP request to those APIs? I have the correct .ovpn files on the system making the request for each of the 3 OpenVPN networks. Is there some parameter I could pass to the request npm module that would allow this, such as a full path to those .ovpn files?

Submitted November 23, 2016 at 01:31PM by nowboarding

Tuesday 22 November 2016

Is typescript worth it?

I've been using node for a while now and I have heard great things about typescript. I think that typescript is really cool in theory and can make for better programming. I recently decided to try making a project in it. As much as I like the syntax I have had huge problems every step of the way with modules and third party libraries. Every library I've used has it's own unique little issues and even when I install the typings I end up often having to cast to any, which defeats the purpose really. It also makes reading documentation more complicated. I have spent hours fiddling with tsconfig files to get all of the module paths working correctly. I use the atom plugin to transpile, which is awesome in that it gives you info when you hover over variables. It is just so hard for me to do even the most basic things. It slows me down at every step. I think this might go away but from where I am at right now it just doesn't seem worth it. Lots of great apps are written in pure javascript. I find gulp really easy and I use babel to use es7 syntax. When I tried to transpile typescript with a gulp task I found it really unintuitive. All typescript really gives me are types and errors that are usually false alarms. I am already using es6 classes so my code is pretty neat in my opinion. I got it working but it just feels so cumbersome. What have your experiences been like? Should I stick it out and switch to typescript? Any tips on using typescript with node? Any tips on using typescript with express (I have had trouble with middleware that required me to cast to any)?

Submitted November 23, 2016 at 05:33AM by celeritas365

Help! I can't save to Mongo using Mongoose and Express for some reason..

So this is working but not writing to the db. When I restart the server the data just resets. Here's the code in my server.js file: var express = require('express'); var mongoose = require('mongoose'); var Schema = mongoose.Schema; var bodyParser = require('body-parser'); var app = express();mongoose.Promise = global.Promise; mongoose.connect('mongodb://localhost:27017/food'); //Allow all requests from all domains & localhost app.all('/*', function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Accept"); res.header("Access-Control-Allow-Methods", "POST, GET"); next(); }); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); var usersSchema = new Schema({ _id: String, id: String, vote: Number }); var bkyes = mongoose.model('bkyes', usersSchema); app.post('/bkyes', function(req, res, next) { bkyes.find({}, function(err, foundObject) { console.log(foundObject); //Print pre-update var found = foundObject[0]; found.vote = req.body.vote; found.save(function(err) { console.log(foundObject); //Print post-update }); }); }); app.listen(3000); /* The console.log pre-update: [ { _id: '582b2da0b983b79b61da3f9c', id: 'Burger King', vote: -1 } ] The console.log post-update: [ { _id: '582b2da0b983b79b61da3f9c', id: 'Burger King', vote: 5 } ] However this data does NOT write to mongo!! */

Submitted November 23, 2016 at 03:37AM by joWebDev

ELI5: Elasticsearch with Javascript. I think I need to use node.js - Not sure I get it...

In a tutorial here it says:Elasticsearch provides an official module for Node.js, called elasticsearch. First, you need to add the module to your project folder, and save the dependency for future use.npm install elasticsearch --saveThen, you can import the module in your script as follows:const elasticsearch = require('elasticsearch');What is "your script"? I know I'm missing something here but I can't figure out what it is. I probably came at this backwards (populating my elasticsearch indexes with python and then thinking about searching it it in JavaScript). I also wasted most of my day trying to figure out django and got pretty far but when it got to the templates and doing 'for' loops with dict() objects I just about lost my mind.I am kind of new to Python but have been using Perl or PHP for 15 years. It's time to update my toolbox.My basic goal is to have an elasticsearch cluster and build a tool to search it etc... I'm sure I can do the JavaScript part but I don't want the browsers accessing elasticsearch directly of course. For this reason I'm pretty sure I need to use node.js. I just have no clue what that means.I've been reading about npm and node.js but I really don't understand how node.js will provide server side javascript.Some of the reading I've done:http://ift.tt/2gjDcci of them really tell you what it means to run a node.js server and how the node_modules installed with npm get used by node.js and how to interact with node.js using javascript in .html files on my webserver. I'm thinking I need to make AJAX calls to the node.js server with the web server that the browsers are using. Am I looking at this the wrong way? Is my understanding of node.js, however limited, also wrong? Should I even be using node.js?I want to avoid using php although I've used it for years. I may have to resort to using python as a CGI but that's just as terrible an idea.

Submitted November 23, 2016 at 01:14AM by DamagedFreight

Powered by Node.js: Control our Selfmade Raspberry PI RC Car via Twitch Chat to Find Free Keys of our Games - Stream Starts Wed 12 pm CET

http://ift.tt/2d6AGXV

Submitted November 22, 2016 at 10:34PM by BLochmann

For some reason running Lab tests from package.json with --inspect fails if you run it *without* ./node_modules/.bin/ -- anyone know why?

My only guess is because Lab uses error domains...From my package.json:"test-debug-nonm": "npm run transpile && node --inspect --debug lab -l -e development -m 120000 -v -r console --coverage-exclude test ./dist/test/unit", "test-debug-nm": "npm run transpile && node --inspect --debug ./node_modules/.bin/lab -l -e development -m 120000 -v -r console --coverage-exclude test ./dist/test/unit", "transpile": "gulp transpile", Note that one uses ./node_modules/.bin/lab and the other doesn't (just lab).Console:$ npm run test-debug-nm # all tests run $ npm run test-debug-nonm ... Error: Cannot find module '/Users/abc/work/def/lab' I'm not sure why this would be.

Submitted November 22, 2016 at 10:00PM by MostlyCarbonite

Node.js Tutorial: Playing Sounds to Provide Notifications

http://ift.tt/2ggj4IF

Submitted November 22, 2016 at 07:50PM by thisdavej

Sails & Trails, and other opinionated frameworks.

I'm looking for a good, solid opinionated frameworks. Something closer to express in terms of functionality and simplistic, but with the structure of rails. I know sails was built on express and borrows a lot of inspiration from rails, but that project seems to of stalled due to some behind the scenes drama?Trails seems interesting but it's docs are lacking.

Submitted November 22, 2016 at 06:00PM by Benny_Omega

Custom build logic post git push with Azure App Service and Kudu for a Node.js web app

http://ift.tt/2fn65Wk

Submitted November 22, 2016 at 01:18PM by thomas_stringer

I loooove hyperdev! There's not a lot of friction in setting up a nodejs project but this brings the friction down to zero. Great for quick prototypes or testing out a library

https://hyperdev.com

Submitted November 22, 2016 at 09:43AM by hihij88

How does "prcoess.nextTick()" works inside Node.js?

http://ift.tt/2ghcLUE

Submitted November 22, 2016 at 09:17AM by nodemonutil

Monday 21 November 2016

[ask] can i use res.redirect with parameter url?

hi reddit.I want to have my create(CRUD) form redirect to the new page that i just create.in route list you can useapp.use('/page/id=:id',page.detail); but i can't use it in redirect. after inserting the new pageconnection.query("INSERT INTO page set ? ", data, function (err) { if (err) console.log("Error inserting : %s ", err); connection.query("SELECT MAX(pageId) as id FROM page", function(err,pages){ console.log("Error inserting : %s ", err); console.log(pages.id); res.redirect('/page/id=:pages.id'); //this part is the problem. }); }); is there a way to solve this?

Submitted November 22, 2016 at 07:07AM by blackkey30

[HELP] saving global variables through crashes

I've written a GroupMe bot that is designed to count down towards goals. The bot reads the chat and looks for specific strings in the text. If the server stays up, it works well. Once the server goes down - everything starts over.I eventually want to expand this to support teams in a GroupMe room, but need help with saving global variables. I'm using Heroku to host the bot.js and it seems that there's regular crashes that eliminate my global variables.Just looking for ideas to explore - what would you look into?In the most advanced planned function, I would be tracking sales of productA and productB at team level (10 teams) against goals for each product. This means I might have 40 global variables counted as integers.

Submitted November 22, 2016 at 05:41AM by Kheiner

Is there anything similar to ASP.Net authentication in node?

One thing that I really like about ASP.Net is how easy it is to handle sign in authentication.ASP.Net will automatically redirect you to the sign on page of you attempt to access a protected page without being signed on. You can do all kinds of cool things with attributes to decide if the user has the proper security to access any given page.Is there anything similar in node.js that can handle these as well as .Net does?

Submitted November 22, 2016 at 05:31AM by angels_fan

Newbie question - Sequential execution using node-bebop

Hey everyone. I have a Parrot Bebop drone and I wanted to store different sequences of moves on various scripts. I did that using node-bebop, and at least the example works, but I created a longer sequence and it doesn't. I've been Googling about it for a while and it seems like it has something to do with the execution of the statements not being done sequentially. Any ideas on how to solve this issue? I've found things like async and wait.for but I don't even know if this is the problem.Links:node-bebop: http://ift.tt/1N708Ig (example is on readme) my script: http://ift.tt/2gfhF4V (it's supposed to 'draw' something like a cross)Thanks in advance!

Submitted November 22, 2016 at 04:47AM by mateoat

Templating in NodeJs with simple signup example with MongoDB

http://ift.tt/2eWbftD

Submitted November 22, 2016 at 05:00AM by akashsethi24

Applications marketplace?

Is there any good and reputable web applications/tools marketplace where I can sell or buy tools or applications that I can host on my own server? an example would be an invoicing application, or any web application that can be hosted.

Submitted November 22, 2016 at 03:17AM by Alexcorvi

Is there anyway to set up a web server behind a router, and make it public without port forwarding?

Specifically, I want to achieve the following, but am not sure if its possible:I have PC1 which will run the web server, and is behind a router (no port fowarding allowed). I want to access the server from PC2 which is also behind a router. I also have a machine in the cloud which can be configured however I want. Is there anyway to set up a connection between PC1 and PC2 by routing through the cloud machine? Both PC1 and PC2 can open outgoing connections, of course.The end goal is to stream video files from PC1 to PC2 without having to set up port forwarding. Thanks.

Submitted November 21, 2016 at 11:21PM by Probotect0r

Can anyone recommend a summary module?

/u/autotldr is a bot that has very decent quality summaries of links posted on reddit. You can read more at /r/autotldrThey use the API from http://smmry.com/ which is quite expensive.I'm curious if anyone knows of any summary modules on npm that have produced equal or better results given a web page/article as input.

Submitted November 21, 2016 at 11:36PM by chovy

http-request-queue: request.js with a limit on the number of concurrent requests

http://ift.tt/2fjeo1R

Submitted November 21, 2016 at 10:30PM by fighterjet-biceps

The more I use npm scripts for tasks the more I wish that package.json was package.yaml

I mean, come on mang. Comments? Heredocs? YAML is a win. My package.json is getting hard to read.

Submitted November 21, 2016 at 09:54PM by MostlyCarbonite

Trying to execute an exe file (youtube-dl.exe) through code, but I keep getting the same error. What am I doing wrong?

I'm trying to use youtube-dl through nodejs. I successfully used it through the command line on windows with the following command:youtube-dl [link to soundcloud song]But when doing it through nodejs, I first had to set its read/write permissionsfs.chmodSync('youtube-dl.exe', 0777);From there, I've tried bothrequire('child_process').execandrequire('child_process').execFileand for both I get the following errorError: Command failed: /app/youtube-dl.exe http://ift.tt/2fkOEWp: 1: /app/youtube-dl.exe: MZ����@���: not found/app/youtube-dl.exe: 2: /app/youtube-dl.exe: $��}ŶHŶHŶH�+�HǶH�+�HĶH�+�HǶH�΀H¶HŶH��H�+�H߶H�+�HĶH�+�HĶH�+�HĶHRichŶHPELOzFT�: not found/app/youtube-dl.exe: 3: /app/youtube-dl.exe: Syntax error: ")" unexpectedDoes anyone recognize this error?Thanks!

Submitted November 21, 2016 at 07:08PM by Pandassaurus

A detailed report of the contents & security vulnerabilities in the latest Node.js docker container (packages, files, CVE's, changelogs, and more)

http://ift.tt/2fc2BFN

Submitted November 21, 2016 at 06:11PM by weighanchore

Build and Authenticate a Node Js App with JSON Web Tokens

http://ift.tt/2gbfzVP

Submitted November 21, 2016 at 06:00PM by Ramirond

how to encode any video files using vp9 codec?

hi there,anyone know how to encode any video files using vp9 codec in node.js?cheers!

Submitted November 21, 2016 at 04:47PM by hbakhtiyor

Using webpack with node.js+express

I've been teaching myself how to program in node.js+express for a little while now, and just a few days ago I looked into webpack for my frontend.I have a basic webpack app working... and, separately, I have my node.js app. I don't really understand how I can incorporate webpack into my node.js app.I use webpack-dev-server to create a live server for my webpack app... but does that mean I need to have 2 different servers running, one for the webpack app, and the other for the node.js app? I feel like I am missing something here.

Submitted November 21, 2016 at 04:13PM by MonkeyOnARock1

The Node.js System, How is it inside Node.js?

http://ift.tt/2eZ17jR

Submitted November 21, 2016 at 04:17PM by nodemonutil

nevernull.js - safe navigation of object trees

http://ift.tt/1hlR2FY

Submitted November 21, 2016 at 02:24PM by enoughalready

My brand new lib for managing async and parallel execution of tasks with limited concurrency

Last year around this same date I proposed to myself that I would get involved with the node/javascript community and start building tools to make our lives easier. I had great success with my previous library DreamJS (http://ift.tt/1Sr4lWJ) helping thousands of developers to create mocking data in a easy and straight foward way.Now I would like to present you my new creation:http://ift.tt/2fxn0mC library is meant to help developers to run asynchronous jobs, tasks and processes with concurrency limitation. It will accept arrays, functions, promises, array of promises, etc as a source and feed it to your process X at time.Please, I really would appreciate some feedback and also invite you to fork, change and contribute to the library if you see any potential.

Submitted November 21, 2016 at 01:18PM by Zartharus

Batch processing on Node

Hi Everyone,I have some periodic batch jobs that I need to run. For example, I have one job that needs to run every 1 minute (dont worry it doesnt do a whole lot).So I chose Agenda (http://ift.tt/1aPPiyo) as my batch job framework. When testing in the DEV system, I noticed that batch jobs dont always run when they are supposed to. For example, if the system is quiet (I am the only developer) the batch jobs run regularly and on time. However, If I am testing or coding I notice that the 1 minute batch job does not run on time at all. In fact, sometimes it just seems to randomly stop running for 20 minutes or so.So the question is: 1. Is this normal behavior? 2. Should I setup a AWS SQS server and have it trigger my batch jobs? 3. Perhaps this is some sort of configuration issue?Let me know your thoughts.

Submitted November 21, 2016 at 11:50AM by OzzieInTx

How to Secure your Koa Api

http://ift.tt/2eWIhKe

Submitted November 21, 2016 at 10:40AM by switcher_g

Decoupling Hot API Integration Tests from External, Stateful Methods

I've been discussing with my team the concept of decoupled API integration tests, and I'd like to get Reddit's opinion on this concept, and see if anyone has done anything like this.I've been experimenting with babel-plugin-rewire, and although it itself seems to be rather stateful when used with ava's default parallel behavior (it won't be in the correct state if run in parallel), it allows me to rewrite methods, method signatures, and responses. This allows me to take conditional testing code out of source files, and keep it within just the test files. I couldn't think of a better way to do this in Babel ESNext.So, that's very fine and dandy, but there's something missing. I can mock external APIs till the cows come home, but lord willing and the creek don't rise, my notion of the mocked external APIs could be colder than a well digger's butt.The flip-side is that I've written hot integration tests before, and it's worse than playing QWOP. This is because they change the state of the systems I'm testing more often than not, and I have to wait for requests to finish, which is going to make the tests brittle if I wait too short, but will take longer if I wait longer. It's a delicate balancing act that is very time-consuming. I wouldn't recommend it, which is why API decoupling is such a welcome concept.I'm just thinking, maybe I might want to have simple, decoupled tests of some kind, similar to the testing signatures I'm supplying to the rewired methods, but unfortunately, that's very difficult in a real-world test plan that's testing real actual things. Getting to a realistic state is often very difficult... But then the other problem is that the external API might be changing often enough to cause issue.Ultimately, if I decouple the test from my own business logic, it still might simplify the equation quite a bit, I might be writing fewer tests, and I'll know if it's me or them. I'd also be running hot tests fewer times, perhaps only on PRs and CI.Anyway, I'm going to continue down this road and I'll report back, if there's enough interest. Also, I'm aware of the stereotypes around narcissist JavaScript devs who are notorious for coming up with a JS way to do something, but it's really an ancient concept that Lisp devs have been doing since the 1960s. But I might do it anyway, so I might come up with a trendy name for it, like DecAPItating your tests.I'm looking for thoughts, critique, even trendier names, better colloquialisms (preferably from the Colorado & New Mexico region), better ideas, and personal experiences.

Submitted November 21, 2016 at 10:38AM by cryptoquick