Monday 31 July 2017

A high frequency, market making cryptocurrency trading platform in node.js

http://ift.tt/1KeNki7

Submitted August 01, 2017 at 03:04AM by shad0proxy

Solit: Hot module replacement on the server, in memory.

http://ift.tt/2uPOQ7M

Submitted August 01, 2017 at 03:34AM by rlindskog

The NodeJS Console API

https://www.youtube.com/attribution_link?a=_rZsdQrwlJY&u=%2Fplaylist%3Flist%3DPLL1UEcDHVPjlmwfe3OlwhZT7LUTrbMW-8

Submitted August 01, 2017 at 03:48AM by duly-node

Any caveats I should be aware of whiles learning node/backend?

I'm pretty grounded in HTML/CSS/JavaScript and some other frontend libraries/tools/editors, for reference. I know a bit of MySQL but only in a vaccum (never worked with it).I'm currently going through Learn and Understand NodeJS by Anthony Alicea as a primer. Is there anything I should beware whiles learning as my first dive into backend? I'm about half way through the course.

Submitted July 31, 2017 at 09:52PM by HiddenLampPanda

Followed node installer. Console says npm is now installed but node is not. [HELP]

I downloaded and ran the v8.2.1 installer from the node site https://nodejs.org/en/ and went through the set up process, then restarted. Everything seemed to go fine. But when I type node -v in the terminal, it says it is not installed.Then I downloaded and ran the earlier version installer and the set up wizard said I had a later version installed. Again the terminal says it is not.But if I type npm -v it gives the file path where it is installed. I installed npm with node in the original installation. I am lost for what to do. Help please?

Submitted July 31, 2017 at 09:05PM by mayaswelltrythis

Blob URLs: how to download/read contents properly?

I currently have a blob URL that I can't read from. Once clicked, it downloads a CSV. All I need to do is read the CSV from the blob link, but I can't seem to get it to work at all.

Submitted July 31, 2017 at 08:45PM by tangerto

Monitor Node.js Applications like a Pro

http://ift.tt/2vg61A1

Submitted July 31, 2017 at 06:01PM by shsh3

API Authentication with Node | #5 - MongoDB/Mongoose

https://youtu.be/QCJCglPLUgg

Submitted July 31, 2017 at 01:27PM by eXtremeRR

Streaming audio from a Node.js server to HTML5 "audio" tag

http://ift.tt/2vaISPK

Submitted July 31, 2017 at 12:04PM by thewwfguy

this: Require current package with require('this'). Useful for testing, no more require('../../')

http://ift.tt/2uMkdju

Submitted July 31, 2017 at 11:09AM by dyslexiccoder

An attempt to answer the age old interview question "What happens when you type google.com into your browser and press enter?"

http://ift.tt/1kIk8QE

Submitted July 31, 2017 at 08:32AM by ratancs

"ORM stands in your way"

I'm about to choose my data access tool for PostgreSQL. I read here more than few times people suggesting not to use high-level ORM (e.g. Sequelize) because it "stands in your way" and decreases the amount of flexibility. Can you provide an example of a specific scenario where an ORM blocked your progress? would love also to hear people thinking the opposite

Submitted July 31, 2017 at 06:31AM by yonatannn

Sunday 30 July 2017

simple language detection module

http://ift.tt/1tmRUNt

Submitted July 31, 2017 at 02:39AM by 73mp74710n

Introduction to Node.js cloud deployment

http://ift.tt/2heDWUg

Submitted July 31, 2017 at 01:57AM by HaeziSoya

I can't find npm, installed node from PPA

Helo, I installed node.js acording the instructions in this page, the node command appears under the name of node.js but the npm is not instaslled. Thanks

Submitted July 30, 2017 at 11:40PM by Aa929

Running a script with prompt-sync in NppExec internal console

Best NPM Module to Compile Standalone CLI?

I've built an application with Node.JS that uses Express and Socket.io, I've taken a look at EncloseJS, Electron, Nexe, NodeWebkit and some others but I'm wondering which would work the best? The main.js that is called and runs the Express server and utilizes Socket.io is all CLI.

Submitted July 30, 2017 at 11:01PM by MemoryPattern

How to call function from browserify?

I have a function like so in my script.js file.function test(){ alert('test'); } and on the html page i include the bundle.js file that browserify creates.I call it in a script tag like so:but it doesn't work.Am i doing something wrong?

Submitted July 30, 2017 at 10:58PM by farhansyed7911

The version 3.0.1 of icu-loader is out

http://ift.tt/2hxhc02

Submitted July 30, 2017 at 07:43PM by msudgh

Node.js portable

http://ift.tt/1Wn1PUQ

Submitted July 30, 2017 at 03:04PM by crazyymaxx

Packaging electron-enabled apps best practice?

I'm developing a node apps using generator-express-no-stress and are using electron for running a simple PDF converter. What I'm now pondering is that how should I choose to distribute my code after building and packaging it? If I refer to 12 factor, I shouldIf the app needs to shell out to a system tool, that tool should be vendored into the app.Now, electron has different distribution for different OS. How should I tackle this problem?

Submitted July 30, 2017 at 03:13PM by wilwol

What is a good and simple nodejs library that provides an embedded DB?

Basically i have some scripts that need to store some state data. The server i will be running the scripts on is a rather specialized device. Unfortunately while the manufacturer provides node v8.x, i am unable to use anything that requires node-gyp. Which unfortunately leaves out PouchDB.I was playing with NeDB, but it relies on callbacks, and it feels pretty akward.What decent alternatives are there?

Submitted July 30, 2017 at 02:39PM by SonOfSpades

How I cut my AWS bill by 90% – Medium

http://ift.tt/2hdLlDa

Submitted July 30, 2017 at 10:42AM by avso

need pair programmer for nodejs

need pairprogrammer for node js

Submitted July 30, 2017 at 10:10AM by sumitpatel93

Node.js tutorial: Optimizing code performance using async

http://ift.tt/2tJhZOe

Submitted July 30, 2017 at 10:26AM by dobkin-1970

Memory Leak Hunting

I have a fairly large and heavily spammed node application that is rapidly using more and more RAM. As we speak, RSS is at 9gb and heap is at 4gb.What are some of the best ways you know of to search for memory leaks in node? Is there a good library for it out there or something?

Submitted July 30, 2017 at 07:50AM by Kerdaloo

Saturday 29 July 2017

Using axios to make a POST request in the same server not working

If it do this: axios.post('http://localhost:3000/myrequest') the call goes through. However, if I do axios.post('/myrequest') it doesn't work (this call does work when called from the client side, though)I'm creating an isomorphic app so the axios call needs to work both on the server and the client side.I keep getting a 502 Bad Gateway error when I don't include the http://localhost:3000Any thoughts on how I can fix this?

Submitted July 30, 2017 at 03:49AM by alwayssans

Streaming With Socket.io

0 down vote favorite I want to model a live digital television station with node js. I would have the media files playing on the server and have clients join in and watch in sync with what the server is showing. How can I achieve this with Node Js. The client could be with a web browser or a mobile application

Submitted July 30, 2017 at 01:07AM by dejhigh

using node to track user activity

anyone has any experience with building node apis for tracking user activity?? also idk if this make sense but i have to built the api using no pre-existing database management systems, which is confusing to me because i'm using mongo and i don't know a way to do it without a system of some sort.

Submitted July 29, 2017 at 11:15PM by _koryjcampbell

4 Types of Memory Leaks in JavaScript and How to Get Rid Of Them

http://ift.tt/2aUXFjQ

Submitted July 29, 2017 at 09:27PM by 73mp74710n

SocketCluster real-time, per-channel user presence plugin

http://ift.tt/2uLXxhH

Submitted July 29, 2017 at 08:53PM by jonpress

SpeakJS – A Discord server for all things JavaScript (with 2000+ members)

Hi, everyone. A few months ago I set up a Discord server that would focus on JavaScript. All of it, though, and not just React, Angular, etc. We’re fast approaching 2500 members and have channels for all kinds of topics. It’s a thriving community that’s been growing without any real advertisement. I’d like to take this opportunity, however, to share a link with you and ask you to drop in and say hello. All levels are welcome! We have some great members who provide really good support for people wanting to learn.I hope you’ll give it a go.http://ift.tt/2eF1tra

Submitted July 29, 2017 at 04:19PM by speakJS

Nested eventEmitters

I have a class that manages a list of dependent items, and a class that represents the item itself. Both the item class and list class can emit events. Users don't generally need to directly manipulate the item objects as the dependency tree is the primary utility provided by the module. Is there a way to have a single event stream? I think I can do it with a singleton emitter, but I really like to stay away from singletons. Would also love to avoid re-emitting every event from the item class, (too easy to forget to add the re-emitter for a new event, also extra typing)Example of what I'd like to do. Line 45 in the example is how I'd like the consumer to interact with the events. Are singletons that ugly here? Is the re-emit pattern better than a singleton? Does it matter? ;)example: http://ift.tt/2vgwA8Z EventEmitter = require('events'); class Foo extends EventEmitter { constructor(){ super(); } fooEmit(){ this.emit('foo'); } } class Bar extends EventEmitter { constructor(foo){ super(); this.foo = foo; // Would like to not have to do this for each // event from foo this.foo.on('foo', () =>{ this.emit('re-emit foo'); }) } passthroughTest(){ this.foo.fooEmit(); } barEmit(){ this.emit('bar'); } } // Want users of Bar to get all the events from Foo bar = new Bar(new Foo()); // works (understand this, just like having a known case) bar.on('bar', ()=>{ console.log('bar emitted'); }) // passing through all of the events from Foo would be awesome bar.on('foo', () =>{ console.log('thisWorks'); }) bar.on('re-emit foo', () =>{ console.log('Would like to avoid this pattern'); }) bar.barEmit(); bar.passthroughTest();

Submitted July 29, 2017 at 01:47PM by skarfacegc

Detecting squatters on npm

http://ift.tt/2eWtSOP

Submitted July 29, 2017 at 12:54PM by sethholladay

Addict, a drop-in Active Directory REST API

http://ift.tt/2vKljdQ

Submitted July 29, 2017 at 06:42AM by dthreeds

Friday 28 July 2017

JavaScript error: sendMessage is not a function

I am trying to call a function from another module and I have included the function in the module.exports but whenever I try to call the function I am given an error TypeError: messenger.sendMessage is not a function.Here are the code snippets:// messenger.js sendMessage is the function that is not working function sendMessage(recipient, recipientmessage, callback){ var options = { url: 'http://ift.tt/1Q7nDgi', method: "POST", qs: {access_token:process.env.FB_MESSENGER_TOKEN}, json:{ recipient: { id: recipient }, message:{ text: recipientmessage } } }; request(options,function(error,incomingMessage,response){ if (!error){ if (callback){ callback() } } }); } module.exports = { router:router, sendMessage: sendMessage }; Here is the module where I am calling the imported module:let Intent = require(__dirname + "/intent-model.js"); let messenger = require(__dirname + "/../app/routes/messenger.js"); function smalltalk(intent){ //this sendMessage does not work and I am getting the error: TypeError: messenger.sendMessage is not a function messenger.sendMessage(intent.accountID, "Hey how are you", function(callback){ console.log("I do not understand why this isnt working"); }); } module.exports = { smalltalk: smalltalk }; Does anyone know why I can't call this function? I can give more code or information if necessary.

Submitted July 29, 2017 at 02:17AM by sk0620

Socket.IO Authentication using Redis

http://ift.tt/2u5YShx

Submitted July 29, 2017 at 01:07AM by thewwfguy

The NodeJS Events Module

https://www.youtube.com/attribution_link?a=qzn490lgwZ4&u=%2Fplaylist%3Flist%3DPLL1UEcDHVPjk4mLBqVC9PHDdb17oDE4ov

Submitted July 28, 2017 at 10:56PM by duly-node

Create tray icon?

I am trying to find a way to create a tray icon (for windows) and cannot find any modules that work.The only one that might work is the tray method from nw.js but it seems to require running it with their own executable, as supposed to running directly with node, which is what I want to do.Is there any way to do this?

Submitted July 28, 2017 at 10:57PM by thatguywiththatname2

Learn Nodejs by building 12 projects

http://ift.tt/2h9p89o

Submitted July 28, 2017 at 09:44PM by alphatym

fmod: Node file modifier

http://ift.tt/2v4rV9N

Submitted July 28, 2017 at 07:52PM by jimmy02020

Announcing Ghost 1.0

http://ift.tt/2v1STOO

Submitted July 28, 2017 at 07:13PM by tknew

How do I insert values only if they arent null or meet whatever condition I want with MongoDB + Express

For example, if "producerName" doesnt equal "Jimbo" or if "producerBGPhoto2" in null, how can I skip those from being inserted or if they dont meet the condition, they get a value of whatever I want. The only logical thing I can think of is, doing an if statement for each value, and then doing an insert for each, but there sounds like a better way.router.post('/producers/adding', auth, multipartyMiddleware, function(req, res) { var db = req.db; var producerName = req.body.name; var producerSlogan = req.body.slogan; var producerLocation = req.body.location; var producerOwner = req.body.owner; var producerWinemaker = req.body.winemaker; var producerWebsite = req.body.website; var producerCountry = req.body.country; var producerParentRegion = req.body.parentRegion; var producerSubregion = req.body.subregion; var producerBio = req.body.bio; var producerEstateAge = req.body.estate_age; var producerLatitude = req.body.latitude; var producerLongitude = req.body.longitude; var producerCoords = req.body.coords; var producerLogo = req.files['logo'].path.substring(6); var producerMap = req.files['map'].path.substring(6); var producerBGPhoto = req.files['bg_photo'].path.substring(6); var producerBGPhoto2 = req.files['bg_photo_2'].path.substring(6); var producerBGPhoto3 = req.files['bg_photo_3'].path.substring(6); var producerBGPhoto4 = req.files['bg_photo_4'].path.substring(6); var producerBGPhoto5 = req.files['bg_photo_5'].path.substring(6); var producerSlug = producerName.replace(/\s+/g, '-').toLowerCase(); var collection = db.collection('producers'); collection.insert({ "slug": producerSlug, "name": producerName, "slogan": producerSlogan, "location": producerLocation, "owner": producerOwner, "parent_region": producerParentRegion, "subregion": producerSubregion, "country": producerCountry, "winemaker": producerWinemaker, "website": producerWebsite, "bio": producerBio, "estate_age": producerEstateAge, "latitude": producerLatitude, "longitude": producerLongitude, "coords": producerCoords, "logo": producerLogo, "map": producerMap, "bg_photo": producerBGPhoto, "bg_photo_2": producerBGPhoto2, "bg_photo_3": producerBGPhoto3, "bg_photo_4": producerBGPhoto4, "bg_photo_5": producerBGPhoto5 }, function(err, doc) { if (err) { res.send("problem adding to db"); } else { res.redirect("../producerslist"); } }); });

Submitted July 28, 2017 at 07:00PM by InsertCoinPushStart

sane-reports: Reports library that will keep you sane

http://ift.tt/2uFGakg

Submitted July 28, 2017 at 06:14PM by meirwah

Naming conventions in Express: middleware vs. controllers

I have a question about naming conventions in the NodeJS/Express ecosystem. I understand that middleware is just a function that takes a request/response object can manpiulate those objects, end or continue the response cycle, etc. I also understand that routing controllers are used to define route actions. I am confused when a method would be considered "middleware" vs when it would be considered a "controller". If we imagine a scenario where a user uploads a photo, then a server manipulates the photo (e.g. adds a watermark), uploads the photo to s3, and then saves a Photo model instance in our database, we might have something like the following:function manipulatePhoto(req, res, next) { next() } function uploadPhoto(req, res, next) { // upload photo to s3 next() } function createPhoto(req, res) { // create new photo using ORM then send response PhotoModel.create({}) .then(() => { res.status(201).send(photos); }); } router.post('/photos/', manipulatePhoto, uploadPhoto, createPhoto); In the example above, would each method be considered a middleware method? Would all the methods fall under the umbrella of a "PhotosController"?

Submitted July 28, 2017 at 04:23PM by mrc1897

Node.js Emerging as the Universal Development Framework for a Diversity of Applications

http://ift.tt/2h3Q4rb

Submitted July 28, 2017 at 03:44PM by speckz

Keep getting 404 not found when trying to link external JS file.

I have a JS file with the structure like so:- main folder ... - node_modules - views ---pages (folder) ---partials (folder) ---script.js ... In my .ejs file I try to use this .js file like so:I keep getting this error:GET http://localhost:1337/views/script.js 404 (Not Found) I also have this set in my app.jsapp.set('/views', express.static(path.join(__dirname, '/views'))); app.set('view engine', 'ejs');

Submitted July 28, 2017 at 12:39PM by farhansyed7911

passport.js authentication with only social accounts (no local)

hello,i'm trying to build a web site that only allowing login with facebook and twitter. so there is no local registration with email or username.the thing confuses me is linking between users' social accounts. i mean the user can use any of his/her twitter or facebook account for login and web site will know these accounts are both the same persons accounts if linked before.can someone show me the way to accomplish this right. thanks.

Submitted July 28, 2017 at 10:54AM by ozzaa

02-Modules in Node js

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

Submitted July 28, 2017 at 11:02AM by sunlight4d

🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda

http://ift.tt/2uYe3O1

Submitted July 28, 2017 at 10:08AM by ratancs

Apollo Server 1.0 — A GraphQL server for all Node.js frameworks

http://ift.tt/2u6Vd6e

Submitted July 28, 2017 at 10:04AM by r-wabbit

What you can do with npx, the new cli tool from npm

https://youtu.be/55WaAoZV_tQ

Submitted July 28, 2017 at 08:03AM by NoGodOnlyCuteness

Create & Deploy High Performance NodeJS Apps on the Cloud and More !

http://ift.tt/2v2Isea

Submitted July 28, 2017 at 05:44AM by sofiakelly

Use Koa-like middleware everywhere with ctx-compose

http://ift.tt/2vdw8rX

Submitted July 28, 2017 at 07:37AM by mrpatiwi

Thursday 27 July 2017

NodeJS: Child Process

https://www.youtube.com/attribution_link?a=Jzwl1JDZVbI&u=%2Fplaylist%3Flist%3DPLL1UEcDHVPjkGyNpXH4Ep4QPXkVDJNetL

Submitted July 28, 2017 at 02:46AM by duly-node

What's the best 'ideaology' in integrating a front-end framework with a node/express based website?

So I've just created a simple "blog" using node, express, and mongoDB. A mongo database hosted on mlab gets queried by node/express, returning an array of posts. The posts are then given to the jade templating engine that then renders an html page with posts.As it is now, I could handle everything with strictly node/express. My question is, where does a front-end framework fit in all of this? What are some things that front-end frameworks enable that I cannot do with node/express alone?

Submitted July 27, 2017 at 09:57PM by bskilly

Best way to simulate traffic before web site launch?

I am working on a project that has a decent amount of live data that pulls from MySQL. A lot of queries that build graphs, are utilized in predictive searching, etc.I want to see if there is anyway to simulate high loads of burst traffic, because I am trying to save money on my hosting. I don't want to underestimate or overestimate, would be nice to be able to get some results that would help.NodeJS + ExpressJS + Sequelize

Submitted July 27, 2017 at 10:00PM by Miles360x

Get ready: A new V8 is coming, Node.js performance is changing.

http://ift.tt/2vbL4XO

Submitted July 27, 2017 at 09:13PM by vertice

Node chakracore update

http://ift.tt/2tNk9kO

Submitted July 27, 2017 at 09:38PM by aderoz

Events API - Use cases

Where are you using the Node.js Events API the most? Specific use cases? A use case would be for a model to emit hooks before and after a record is saved in the db but Im questioning the benefits over calling specific functions from the parent caller.Thanks

Submitted July 27, 2017 at 05:44PM by kostarelo

Node-ChakraCore Update: N-API, Node.js on iOS and more

http://ift.tt/2eQADlv

Submitted July 27, 2017 at 05:23PM by ben_a_adams

logem: What we use internally for Node.js logs

http://ift.tt/2w3o89f

Submitted July 27, 2017 at 04:07PM by tarunbatra

On the road to Strapi v3!

http://ift.tt/2tMnq3v

Submitted July 27, 2017 at 02:05PM by pierreburgy

The best from admin panels built by successful businesses.

http://ift.tt/2h5KBjI

Submitted July 27, 2017 at 01:15PM by jcgasche

QUICK QUESTION: Should we use queues for non-blocking logging?

I have an App using Express which has to scale pretty high and is cloud based. When reading through best practices for logging (I am implementing logging for the first time) I read that you should never let the log interfere with your app as in, take resources that could be used for clients.Does this mean that I should use some kind of queue and work on the logging asynchronously or is it fine to just treat logging as an essential step in the program?If it matters any, I will be using Loggly and their winston-loggly-bulk package.

Submitted July 27, 2017 at 11:17AM by ThatBriandude

API Authentication with Node | #4 - Server-Side Validation

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

Submitted July 27, 2017 at 09:04AM by eXtremeRR

A collective list of public JSON APIs for use in web development.

http://ift.tt/1UwWif1

Submitted July 27, 2017 at 08:25AM by ratancs

Wednesday 26 July 2017

NodeJS: FileSystem

https://www.youtube.com/attribution_link?a=FtrF10pP5po&u=%2Fplaylist%3Flist%3DPLL1UEcDHVPjkGjqM4mvAb2z9meV7jWmbd

Submitted July 27, 2017 at 04:54AM by duly-node

Any recommendations on good email address verification services?

Hey guys, I'm building an app where our client companies will be bringing in their database of contacts into our system. This database includes a series of emails address.It's often the case that these emails are outdated or inactive. I'm wondering if anyone knows of any good services that can check and test whether an email is actually valid.I know Kickbox.io is one of the solutions that provides such services. Are there better options out there? Would love to know your opinion!

Submitted July 26, 2017 at 07:08PM by snahrvar

Need opinion on open- source realworld node.js project

Hello,I'm learning node at the moment and looking at various projects to learn best practices etc. Just wanted to ask opinion of more experienced node.js devs about this project aka realworld code quality. By skimming through code what you think ?LINK: http://ift.tt/2tZMwaw !

Submitted July 26, 2017 at 07:31PM by nodelearner

16 plugins to extend TestCafe functionality

http://ift.tt/2tZwOfm

Submitted July 26, 2017 at 06:38PM by henry_tula

Export & Consume Modules in Node.js

http://ift.tt/2uBAeqT

Submitted July 26, 2017 at 03:22PM by niravsh0102

Express and Sequelize many-to-many

Hello, i just started working with Sequelize, and have to say I feel the docs are a bit incomplete could just be me. I wanna create a many to manyAnd the user has many tickets and a ticket has many users.I have used the sequelize-cli to generate the migration and model for User and ticket, and they look like this:'use strict'; module.exports = function(sequelize, DataTypes) { var Ticket = sequelize.define('Ticket', { title: DataTypes.STRING, description: DataTypes.TEXT, status: DataTypes.TEXT, type: DataTypes.TEXT, priority: DataTypes.TEXT, created_at: DataTypes.DATE, updated_at: DataTypes.DATE }, { underscored: true, classMethods: { associate: function(models) { Ticket.belongsToMany(User, { thorough: UserTicket }) } } }); return Ticket; };'use strict'; module.exports = function(sequelize, DataTypes) { var User = sequelize.define('User', { first_name: DataTypes.STRING, last_name: DataTypes.STRING, email: DataTypes.STRING, password: DataTypes.STRING, created_at: DataTypes.DATE, updated_at: DataTypes.DATE }, { underscored: true, classMethods: { associate: function(models) { User.belongsToMany(Ticket, { thorough: UserTicket}) User.belongsTo(Group) } } }); return User; };I have than created a migration for UserTicket manually which contains a table that has a user_id, and ticket_id. I try to get the all users in a ticket by doingrouter.get('/:id', auth.authenticate(), function(req, res, next) { Ticket.find({where: {id: req.params.id}}, { include : [ { model: all, nested: true }] }).then(ticket => { return res.json(ticket) }).catch(err => { console.log(err) }) });The error in my console is just GET /api/ticket/1 500 100.092 ms - 427 Executing (default): SELECT id, first_name, last_name, email, password, created_at, updated_at FROM Users AS User WHERE User.id = 1;Nothing else Hope someone can guide me a bit here.

Submitted July 26, 2017 at 03:28PM by cawex

[Question] Can I update Node.js whenever?

As the title says, I would like to update Node.js. I currently have v6.11.0 show up when I run 'node -v'. I was wondering though, could anything negative happen to the webapplications I have created currently by updating?

Submitted July 26, 2017 at 01:37PM by inochy

This is what Node.js is used for in 2017 - Survey Results

http://ift.tt/2h30uHl

Submitted July 26, 2017 at 02:08PM by hfeeri

Best way to use Typescript with node & browsers

I've been working on a game as a hobby on and off for about a year now and it's finally come time to implement the multiplayer aspect of it.I've managed to get a simple Node server up and running and send messages between the server & clients.I'm using TypeScript on the client without issues, but issues arise when I put client & server code in the same project.On the clientside so far I've been using RequireJS with ES6 imports and it's been working great.. But this seems incompatible with Node's own Require function, and TypeScript complains. I've also tried Browserify & SystemJS without much luck.The client and server will essentially be separate apps, but will need to share common data - Enums, Interfaces, cfg, etc.Does anyone have any ideas, examples, or tutorials that would help me in this matter?Thanks for your time!

Submitted July 26, 2017 at 11:57AM by drummer_si

Your preferred project structure: A vs B (diagram inside)?

Which of the above is your preferred project structure for large-scale node backend apps?Diagram here: http://ift.tt/2uYCHxG = typical MVC-like where all the features are spread in multiple folders based on their technical typeB = files are grouped by their business features, each contains all the artifacts of a single business domain/feature

Submitted July 26, 2017 at 12:19PM by yonatannn

What you should know to really understand the Node.js Event Loop

http://ift.tt/2vZETCy

Submitted July 26, 2017 at 08:48AM by justintimecoder

Tuesday 25 July 2017

Best way to access Sequelize models from another system?

I have an expressJS w/ Sequelize setup.Would it be possible to remote connect to the MySQL w/ the Sequelize models on a seperate VPS? I do not want the entire project copied/pasted

Submitted July 25, 2017 at 11:56PM by Miles360x

Can I implement token based auth in a «cookie-like» way?

I'm creating my first SPA using NodeJS stack for development and I came to a point where I should design authentication and secure some parts of the app.I read a lot about auth techniques including JWT, OAuth, etc. but I still didn't find something like «a real world example».Let's assume that my task is just to secure some parts of app from public. My app isn't designed to work with 3rd party services so I see no need to use something like Google or Facebook auth. I want to use login/password and store all this data using my own database server.I don't understand the point of having authentication stateless. I came to a simple conclusion that I can design authentication in this way:I store users logins and passwords in my database.User auth means that user enters his credentials, server checks it and creates token. Then server saves this token into database. User saves token using browser local storage or somewhere else if it's not browser environment.On each request client sends this token, server checks that this token exists and responds appropriately.User can login from different devices, we just create multiple tokens for him.We can end specific session or all sessions by just deleting user tokens from database.We can manage tokens in a way we want, for example server can check expiration time and invalidate (delete) token.Is it OK? JWT require additional implementation if we need to invalidate token, I saw different examples, all of them were based on storing invalid tokens but what's the point of that if we can just store valid tokens? We already lose statelessness by implementing this storage.I see that I can just use cookies instead of implementation described above but I don't like an idea to use cookies in RESTful app because I don't see the point of sending cookies from not-browser like environment.What are the disadvantages of just storing tokens on server this way?

Submitted July 26, 2017 at 12:09AM by Max_Stern

How to Use Async/Await to Wait for forEach Loop to Complete Before Moving On

I've searched for solutions, but I'm not quite getting it. I want to process some calls thru a _.forEach() loop, and not continue until after the loop is complete... or, rather... until all the code called from within the loop is complete... but I'm not sure where to put the asyncs and awaits to accomplish this.For example: let sources = { ...a dictionary... } async function getAllData() { _.forEach( sources, function( source ) { processThisSource( source ) // I want all these processes to complete before moving on } } getAllData().then( () => {} ) This doesn't seem to work. Can someone point me in the right direction?Thank you!

Submitted July 25, 2017 at 11:23PM by cklester

Best practices for app with web and worker processes, and communicating background job results to client via socket.io?

I have a question about the best practice structure when dealing with a web server, background worker job queues, and needing to push job results to connected clients via websockets using socket.io.Normally I have the following setup: Web server receives request, responds to client quickly, then starts a new background job on a worker queue. On the worker side of things some work is done and saved to the database, maybe an email is sent out, etc. However, for the first time I now need to communicate the job results back to the client using socket.io.So my question is how to properly push job results to the client? Should the worker be able to use something like socket.io to communicate back to the client? Is this even possible if the client is connected via socket.io to the web server, but the background worker is on a completely different machine? I guess an alternative would be the worker could queue up a "results" job itself that the web server listens for, and then the web server would be the one sending the socket.io message back to the client, but I'm just not sure how practical this is or what the best way to do this is.I don't have a ton of experience with websockets or scaling large apps so curious how to structure all of this. Appreciate the help thanks!

Submitted July 25, 2017 at 09:15PM by m9js

Writing funny stories with friends with Programmable Chat

http://ift.tt/2gZMEWj

Submitted July 25, 2017 at 09:40PM by gregbaugues

Using node Docker image? Get updates on CVE changes with this tool

https://beta.anchore.io

Submitted July 25, 2017 at 06:40PM by weighanchore

SQL Server (mssql) API hosted on IIS

Links:iisnodemssql 4.0.4I'm messing around with creating an auth protected API to replace a legacy Coldfusion API and worked through getting a CRUD API running on my local machine with my local version of SQL Server.There's quite a few issues that I don't fully understand and I'm hoping to get some insight:is iisNode still a top option for hosting node on IIS?once deployed, will my settings.js that have my config user/pwd be public if somebody parses all the js files? Do you just make a locked down sql user that can have limited db rights for that account or is there a way to have that file not readable?has anybody gone down this path before and have insights as to pros/cons with regards to living in the Microsoft Web API world? I try to remain flexible about what tools I'm using and like C# but also enjoy javascript and feel comfortable in both worlds.

Submitted July 25, 2017 at 05:30PM by ExcuseMyTriceratops

Node.mjs on Twitter: "A PR for Node.js to implement native ES module loading via ".mjs" extension detection. https://t.co/MB0a2MKpEs"

https://twitter.com/nodemjs/status/889647517046013952

Submitted July 25, 2017 at 04:55PM by Mittalmailbox

Disabling Bunyan in tests

http://ift.tt/2h0eNMN

Submitted July 25, 2017 at 03:34PM by sheshbabu

General Survey: Do you prefer Angular or React?

I'm not looking for a flame war, just want to see what people are feeling these days. But I'd love to hear all your thoughts. I'm currently using Angular for my existing project, but would consider using react for future projects.Cheers

Submitted July 25, 2017 at 03:50PM by snahrvar

Is it necessary to use PUT and DELETE in addition to GET and POST?

I may sound like an amateur asking this question from the community, but I genuinely have never felt the need to use PUT and DELETE. Is this bad practice? Am I missing something important?

Submitted July 25, 2017 at 03:51PM by snahrvar

Why Go is Objectively Better Than Node - TJ Holowaychuk

https://twitter.com/tjholowaychuk/status/887572412002222080

Submitted July 25, 2017 at 02:18PM by djslakor

Heroku and multiple apps?

Hi there!So it's my first steps in the world of nodejs and I'm ready to host my app.I read that Heroku was pretty good, so I looked into it.So it seems to be 1 dyno per app? It get expensive fast for my small project.What I need to host : - Angular Landing page - Angular Transaction web app - A little ETL app made with nodejs. (extract data from a zip file taken in a ftp and upload it to nosql database)Can I do all of this on the same Dyno? There won't be much traffic early (and probably ever).I could probably make one app with the landing page and the transaction web app, and the ETL won't require web input.Should I use multiple hobby dyno? Or go with 1 hobby dyno and host it all on the same.I'm asking this question there cause I don't know what kind of ressources require Nodejs.Also if you have anything else then Heroku that you use, I'm open!

Submitted July 25, 2017 at 02:20PM by Kardiamond

Going real time with Socket.IO, Node.Js and React

http://ift.tt/2tzcfr2

Submitted July 25, 2017 at 11:38AM by GitW_85

One tool for all password validation techniques

http://ift.tt/2oDSxHO

Submitted July 25, 2017 at 10:12AM by tarunbatra

Creating RESTful API using NodeJS & MongoDB

http://ift.tt/2gZ8VDK

Submitted July 25, 2017 at 09:36AM by mikehurlie

Monday 24 July 2017

How to change from number to image

So atm i have numbers on the screen as i set them to math.random but i want to have them as an image, actually as a sprite. i have the sprite ect already done but its on the client side and i need it on the server side. Any help would be great, here's a link to a pastebin if that helps you understand what i meanhttps://pastebin.com/eGzZsmF1

Submitted July 25, 2017 at 04:03AM by alphan00b

File system module that will clone and apply file permissions with objects

Looking for a way to get fs.stat into and object then apply that object to other files, basically clone the majority of permissions, ownersjip,etc

Submitted July 25, 2017 at 04:20AM by cyanydeez

Hi, I made a new module for Active Directory. Reviews appreciated.

http://ift.tt/2uUJDNg

Submitted July 25, 2017 at 04:22AM by dthreeds

Code poster site built with node, aws lambda & React

http://ift.tt/2uurQJC

Submitted July 25, 2017 at 01:01AM by fragosti

Pathre: Node path-resolver utility functions.

http://ift.tt/2urjBjg

Submitted July 25, 2017 at 01:14AM by jimmy02020

Help with hapi.js

Hi. So im basically trying to make my own MVC with hapi, but to do this i need to be able to pass functions to my handler thru a "controller". The only way i can make a handler work is by doinghandler: function(request,reply){reply('hello')}But i want to be able to used a named function instead thru an export,like this.Function Index(request,reply){reply('hello')}Then set my handler equal to handler:Index().

Submitted July 24, 2017 at 11:10PM by Caller_of_Souls

Practical Node.js book has been Open Sourced

http://ift.tt/2eIvFXI

Submitted July 24, 2017 at 08:06PM by tknew

Introducing Monogram, the Anti-ODM for Node.js and MongoDB

http://ift.tt/2uRhCp0

Submitted July 24, 2017 at 06:45PM by code_barbarian

Send ObjectId using jwt.sign error

I've been trying to send the user object id when a user logs i via the logintoken so that i can access it in my index.html using: but it keeps giving a error: SyntaxError: Invalid shorthand property initializervar token = jwt.sign({ username: user.username, email:user.email, id = user._id }, secret, { expiresIn: '24h' }); // Logged in: Give user tokenWhen this token is assigned to the user, how do i get the user object id in the index.html? This should follow when i run the following code, right?// Route to get the currently logged in user router.post('/me', function(req, res) { res.send(req.decoded); // Return the token acquired from middleware });

Submitted July 24, 2017 at 07:42PM by Sirzorre

DIRECTV went into production with Node.js in less than 1.5 yrs. Here's how they did it.

http://ift.tt/2vspWt4

Submitted July 24, 2017 at 06:50PM by flamemuffin

Nodock v0.8 - Complete NodeJS Environment for Docker - Now with Apache2 support

http://ift.tt/2g8sJEh

Submitted July 24, 2017 at 06:30PM by omegafivethreefive

Move faster than your competition with backend automation.

http://ift.tt/2vBn2SR

Submitted July 24, 2017 at 05:57PM by nawazdhandala

Scaling Node.js applications

http://ift.tt/2tkK2TI

Submitted July 24, 2017 at 05:06PM by codedesi

An Easier Way to Authenticate Users in E2E Tests

http://ift.tt/2tuceol

Submitted July 24, 2017 at 04:14PM by henry_tula

Learn Node JS Online or at Coding Blocks Delhi

http://ift.tt/2uPJvxQ

Submitted July 24, 2017 at 02:44PM by sureshryan

I'm lost with back-end server technologies! (xpost /r/webdev)

Hi,I've been tinkering with webdev for at least a year now in my free time. My frontend skills are pretty decent and I have a ubuntu server hosted by DigitalOcean running a LAMP stack.I want to move away from LAMP (as I'm not a fan of php, and want to learn the new hip tech) and move towards Node! I tried Django but settled for the JS option, i'm also terrible with apache..I've started learning Node with express but I'm getting myself a little confused with how to implement all of my domains, pages & apps on one server. After lots of googling, I came to a shaky conclusion...Am I right in thinking:I think I need to run apache/nginx anyway, and I can run nginx on the server, which routes the requested url to different node apps? i.e www.mysite.com goes to one particular app, www.othersite.com goes to a different app.Do I use a separate node app for each page? i.e do www.mysite.com and www.mysite.com/about use different node apps?Do I even use node for static pages?I'd really appreciate some clarification! I feel totally swamped here.

Submitted July 24, 2017 at 01:34PM by MightyLemur

How to Start Contributing to Node.js

http://ift.tt/2sqmC3K

Submitted July 24, 2017 at 09:10AM by ginger-julia

ES8 was Released and here are its Main New Features 🔥

http://ift.tt/2u0zIEY

Submitted July 24, 2017 at 08:18AM by ratancs

Sunday 23 July 2017

Video stream with Node.js and HTML5

http://ift.tt/2vOBCWh

Submitted July 24, 2017 at 02:32AM by HaeziSoya

Handling Operational Errors

Hi,I have code that updates data in a database (I'm using Sequelize as ORM) and passes the status of update request to the client (I have vuejs on the front end). The code works for my purposes but I would like to know if there are 'better' ways to handle error cases.my code below:app.patch('/api/device/updateshipment', function(req, res) { Device.update({ so_number: req.body.so_number, shipment_date: req.body.shipment_date }, { where: { serial_number: req.body.serial_number } }) .then(function(updatedDevices) { if(updatedDevices[0]) { res.status(200).end('Shipment details updated'); } else { res.status(404).end('Serial Number not found'); } }) .catch(function(err) { console.log(err) }) In the front end, the update status message (e.g. 'Shipment details updated') is then displayed to the user.How would I make use of the Error object in the case above (and is using Error object in this case considered best practice? Why?). Any other recommendations welcome!Thanks in advance!!

Submitted July 24, 2017 at 02:34AM by raccoonranger73

Alternative to Swagger API generation/documentation?

Package: http://ift.tt/2uqqIGN wondering if any of you know of any potentially better alternatives to Swagger, I've tried this out and it is pretty cool being able to generate paths as I update the documentation, then building out from there, although I do not want to fully commit unless I know of other alternatives that are able to do the same thing functionally.So far the only issues I got out of this was:The autogenerator is out of date and ends up using outdated configs which can make the app non functionalIt does not support async functions properly (throwing an error within an Async function gives an unhandled catch error)Documentation isn't that great on certain features (i.e. defining auth methods e.g. bearer tokens)

Submitted July 24, 2017 at 03:08AM by cruzcontrol56

Why waterfall is so slow

http://ift.tt/2gVxHob

Submitted July 24, 2017 at 02:00AM by thewwfguy

The Era of Module Bundlers - JSConf Belgium 2017

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

Submitted July 23, 2017 at 10:34PM by amdsouza92

Request within a request - How to 'wait' for all requests to be made before continuing.

Hey y'all, I know this goes a bit against the non-blocking stuff - so maybe I can clarify here.I've got a bot I'm working on that when asked for info, he will return a parsed JSON into the chat all nice-like.So fist thing is it makes a request, gets the JSON back - now one of the fields is another link to the api - so instead of publishing that string, I'd like for it to make a request from that url, when that returns, it'll grab the property I need, then return all the info back for the bot.reply() to handle.Here's the first request - Someone asks the bot 'I'd like to know about X' http://ift.tt/2vyKlg6 you can see, the spouses property returns the url, I'd like to make a second request using that url and merge all that info back for bot.reply() to use in it's message.

Submitted July 23, 2017 at 06:57PM by TubaSpoof

Azure Functions, Node.js and Environment Variables

http://ift.tt/2uJXT8f

Submitted July 23, 2017 at 07:05PM by justintimecoder

Is there a module for splitting arbitrary command line commands into arrays?

Let's say I have the following command stored as a string:cp My\ Pictures/cute\ kitty.jpg "/mnt/USB/my secret stash/" I want it parsed as an array:['cp', 'My Pictures/cute kitty.jpg', '/mnt/USB/my secret stash/'] Is there an existing module that can do this?Note that I'm not looking for things like minimist or yargs. These parsers operate on process.argv, which is already an array.For now I've cobbled something together using string-tokenizer, but it doesn't handle the edge cases above.

Submitted July 23, 2017 at 07:08PM by JoeyMallone

Unit testing Express controllers.

Hello all, I've currently got an application which involves two Express servers. One being an api, another being server that queries the api and serves the web pages.I've performed some integration tests with Mocha, Chai and Chai-http on the api, making sure the http response and data returned is correct - but I'm wondering what is the standard way to test controllers that query/render the api. Below is a sample of what a controller would do.exports.get = function (req, res, next) { const posts, foo, bar; /* Query apis, validate and store data in variables */ res.render('partials/index', { posts: posts, foo: foo, bar: bar }); } }); Any help would be greatly appreciated as well as any resources on unit testing in this manor, I've been fiddling about with Sinon and not sure if this is the right direction to go in.Many thanks.

Submitted July 23, 2017 at 05:26PM by wires55

Throttling/queuing requests coming from different users hitting same route

Hi r/ this is my go to again (vs going to stackoverflow)... as the title suggests i have several users hitting the same route in express. I'f like to place them in a queue and release each request after 8 seconds... any help would be greatly apreciated!

Submitted July 23, 2017 at 12:39PM by DepressedHypeman

Saturday 22 July 2017

How to run node to auto restart after file change?

Please I'm just started working on http://ift.tt/1NLvIa3, but can't figure it out how to run node to auto restart on file change. I already created an Issue http://ift.tt/2tr7kYY, because CONTRIBUTE.md doesn't mention it (or I missed it). Thanks in advance.

Submitted July 23, 2017 at 06:24AM by mikael12

What do you use NodeJS/JavaScript for?

I know most of you will say web development, so be more specific :). If it is only front end web development you use JS for, don't bother replying.

Submitted July 23, 2017 at 03:11AM by Flame2057

Video streaming with HTML 5 via node.js

http://ift.tt/2tzXzf3

Submitted July 23, 2017 at 01:26AM by thewwfguy

Discord.js Question

So I installed the discord.js package and made sure everything was working with a simple welcome message.I wanted to make a discord bot that would replace any post containing specific keywords with "insert whatever". Could anyone advise me on how to do that? I looked through and saw a delete method in discord.js but unsure how to replace. Thanks

Submitted July 22, 2017 at 09:11PM by Nich9

NodeJS YouTube MP3 downloader built with Electron

A few days ago I saw a Reddit post from someone asking what cool and special things Node can do, and the first thing that came to my mind was the ability to write desktop apps in JavaScript using services such as Electron and NW.Because I wanted to make an example of a type of desktop app that can be built in Node, and is actually useful, I decided that today I'd build a desktop app which searches for YouTube videos, then allows you to convert them to MP3 files.The full source code, along with a list of all the features, can be found here: http://ift.tt/2tpX8zV is greatly appreciated! This is only my second Electron app, so I know it's far from perfect and could be improved greatly.

Submitted July 22, 2017 at 09:51PM by RedDuckss

Node.js template for developing a Microservice

http://ift.tt/2vLHm37

Submitted July 22, 2017 at 06:53PM by tarunbatra

Best Practices for representing Times in Node

(I'm still getting my head around some things here, so sorry for the simple questions.) What is the best recommended way internal to your application to pass dates and times around?Currently I'm loading from the data store, converting into a Moment object in the UTC Timezone inside the DAO, and passing this Moment object around. And this works fine, but it's a bit clunky at the unit testing layer - I can't trivially just compare two objects that happen to contain a Moment and expect it to work.Is it better to instead pass around a Date() object - given that Javascript doesn't do timezones properly? Or to pass around a unix timestamp (seconds or millis since the epoch) or an ISO-8601 String? All of these would work better for unit tests, and then I can do the conversions for timezones and formatting at the very last moment. I'm currently leaning towards the ISO-8601 string, but I'm not sure what is the generally recommended best way to handle this?For reference - I'm talking about what data type to store these values in inside the model objects that are used in between the DAO and the HTTP layer, and these model objects travel in both directions. Inside the database it's just a TIMESTAMPTZ that is used, always in UTC, and over the HTTP API it's always an ISO-8601 String, but on occasion in between the two I need to be able to compare and manipulate the values.

Submitted July 22, 2017 at 06:54PM by sazzer

better way to test with nodejs?

I normally write some code, check it in my browser and then use the website developer tools to pick apart what's working/not working.This usually does the trick for me but I wonder if there are any better methods of testing during development with atom/nodeJS?

Submitted July 22, 2017 at 07:42PM by goingtoriseup

Help request: Installing package Scribbletunes from npm

Howdy folks, I'm new to this nodejs area and was wondering if I could get some help installing this package. I keep getting a directory issue and this is what it returns. Any help?npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\USER\package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\USER\package.json' npm WARN USER No description npm WARN USER No repository field. npm WARN USER No README data npm WARN USER No license field.

Submitted July 22, 2017 at 05:59PM by SpasmaticPress

any up-to-date pdf to svg converter module available?

No text found

Submitted July 22, 2017 at 06:23PM by hbakhtiyor

Can users modify files served to a webpage with Express?

I'm trying to make a .io game and I want to make it hackproof. Can players modify the data that gets sent to the server by changing the source code? If so, how do I prevent this?

Submitted July 22, 2017 at 06:30PM by PM_ME_CELL_FACTS

New to Sails.js, got some questions

Currently working on my first Sails project, just like the guide suggested i started off with v1. One thing i've realized that a lot of (database) related stuff is implemented in-app instead of being database level, and thus i am wondering:how does one (properly) define (database level) triggers trough sails?Also is it somehow possible to add (database level) relations?

Submitted July 22, 2017 at 04:22PM by kinsi55

How to write beautiful Node.js APIs using async/await and the Firebase Database

http://ift.tt/2tOWtvY

Submitted July 22, 2017 at 03:37PM by katerina-ser60

Question about promise and callback

Hi, I've recently discover all the power of the promises. But like many newbie I fall in the trap of using this paradigme most of the time (even when I don't need it). So basically most of my route are like that : /my-routeparams = {all object from the req I formatted in the first function}myFunction1(params)then(myFunction2)then(myFunction3)then(myFunction4)then(myFunction5)then(function(params){send result})catch(send error) Note: Param is an object where every function modify/add property to it. Until the final result. In one side, it's really really clear. I can move/remove/comment functions in 1 second. And catch the error quite easily. But I don't at what extend it's slower. But it is definitively slower than callback. I have to add to that (yes, i'm really trapped!) that most the function in the process called themselves other promises. It's a bit complicated, but put simply I have to generate data and file and then return a urls of those file. So there are Q.all() here and there. So my questions : 1) Is there a design pattern to have the power of promise but without falling in this trap 2) Is it a good practice to use promise on long process (but non async) ? I know there are some function that can take 50-100ms because of cpu calculation. 3) Any advice for me Thank you so much for your feedback. (my code really need it!)

Submitted July 22, 2017 at 01:13PM by pauldupont34

I needed the server to throw an exception, I was short on words to use to trigger it...

let userID = Userlookup[0].ID || 'Xylophone';

Submitted July 22, 2017 at 08:39AM by OzziePeck

A 16-bit virtual machine, including assembly language with 35 instructions, binary assembler, and a step through debugger. Built with javascript

http://ift.tt/2vtsuHB

Submitted July 22, 2017 at 07:31AM by 73mp74710n

Friday 21 July 2017

package.json not being read on AWS Beanstalk

I deployed a simple app to Beanstalk via terminal using eb deploy I have a package.json file in the main folder of my app like normal.But it seems that when i do eb logs it doesn't read the package.json file.npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/var/app/current/package.json' npm ERR! enoent ENOENT: no such file or directory, open '/var/app/current/package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Please include the following file with any support request: npm ERR! /var/app/current/npm-debug.log npm ERR! Linux 4.9.32-15.41.amzn1.x86_64 npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.11.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.11.1- linux-x64/bin/npm" "start" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! path /var/app/current/package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open Any help would be appreciative!

Submitted July 21, 2017 at 11:36PM by farhansyed7911

How to go about building a personal password manager api?

I'm an intermediate node developer and an expert Android developer. I use LastPass, but I would like to build a personal password manager API. How should I store passwords and how should I retrieve/parse them? I'll likely just be using MongoDB.

Submitted July 22, 2017 at 01:58AM by rhynoboy2009

A needjs based telegram bot api

http://ift.tt/2uQRPhh

Submitted July 21, 2017 at 09:15PM by MCSajjadH

Is es6 completely useless?

Hi guys,I would like your opinion about a conversation I had with my client. I developed an API in Node.js using Express + Postgres database for Heroku, It's a simple app to allow users to write internal support tickets, nothing fancy.The client's javascript specialist gave me the following feedback:"Never use es6 classes or extends, only objects (even though I know it's syntactic sugar); never try to write a db layer, use ORMs for that."To put the icing on the cake, the client also said I'm probably the only person who uses extend in javascript.Do you guys agree with the above statements? Why not to use es6 classes if they exist?Unfortunately I can't post the code here for obvious reasons.

Submitted July 21, 2017 at 09:14PM by celicoooooooox

Could Use Some Guidance Regarding HTTP-Request/WebSocket Scenario

Hi all,My goal is straightforward. I have a script ABC that produces the result XYZ only when entered in the console of website 123. AFAIK this website does not have specific code in it that allows others to connect and retrieve data (so socket.io is out of the question).I've tried a Websocket connection, but it keeps on failing (according to http://ift.tt/1u59RQK, the website isn't even allowing the connection, so not a fault in my code). Currently messing around with HTTP-Request. Is there some sort of library or npm module I could install that would help me out here?Basically, what's the best way to code my node.js file to send script ABC to website 123, and then retrieve the result XYZ and log it in my client-side console?Thanks in advance for any tips.

Submitted July 21, 2017 at 09:13PM by SaudFraud

Convince a Fortune 500 to switch to Node.js and going into production it within 1.5 yrs: Story of Matt Savino at DirectTV

http://ift.tt/2vspWt4

Submitted July 21, 2017 at 08:04PM by flamemuffin

Need help setting up auth0 with browserify

I'm having problems getting the auth0 setup to work with my browserify. I have posted what I hope is all the information on stack overflow here but will add to it if needed. Any help would be much appreciated. I have tried many different things with requiring auth0 and angular-auth0 to no avail.http://ift.tt/2uJbI9k

Submitted July 21, 2017 at 06:05PM by Weirdhomeboy

Some questions about NodeJS

I have nodeJS/NPM installed globally (on my native machine) - I am installing packages locally in a project which get put into node_modules folder - and then as I install them - they get added to my package.json dependancie file in the root of my project directory.So #1 - I just installed one package, and my node_modules folder in my project folder is 11 mb in size. If I am going to deploy this to a customer, how does this even work? Where are all of these files being stored/served? Is this the whole purpose of nodeJS? That they would be stored server-side and the client would just access the actual files as needed without requiring the download of them? I think that's kind of an eye opener for me if that's the case2 - If I wanted to have a project with an admin panel - so basically a way for the owner of the project to be able to change the layout of a project for example in real-time. Would I be able to do this strictly with nodeJS without a database - or would I still need something like MongoDB or just a regular database to store the properties of the project?Thanks sorry for the dumb questions

Submitted July 21, 2017 at 05:12PM by goingtoriseup

Knock Knock. Who's There? File Compression

http://ift.tt/2vrM2vF

Submitted July 21, 2017 at 02:00PM by codedesi

React + Express Social Network.

I am just starting to learn the MERN stack and though, that a great starting goal would be to create a social network ('a FakeBook'). But I just don't know where to start, with PHP everything is easy. But with the MERN stack how do I package everything together ?

Submitted July 21, 2017 at 01:09PM by PaulyTime

Node.js - Weekly News Collection

http://ift.tt/2uGfbFO

Submitted July 21, 2017 at 01:23PM by hfeeri

MEAN and Cosmos DB - Maybe a good alternative to MongoDB or mLab hosting

http://ift.tt/2u1tJ1I

Submitted July 21, 2017 at 11:46AM by aderoz

Javascript tools for end-to-end testing web applications

http://ift.tt/2vlIVFF

Submitted July 21, 2017 at 10:20AM by krylovanatu

NodeJS and PhantomJS consecutive promises. Last one not being fired

I am using PhantomJS to login a website using node.js. After that I want to make an HTTP request to obtain a json with data. My code is as follows:phantom.create() .then(function (ph) { this.ph = ph; return ph.createPage(); }) .then(function (page) { this.page = page; return page.open('https://example.com'); }) .then(function (status) { if ( status === "success" ) { return this.page.evaluate(function() { document.querySelector("input[name='j_username']").value = 'example@example.net'; document.querySelector("input[name='j_password']").value = 'example'; console.log('Submitting logging...'); document.querySelector("input[name='submit']").click(); }); } else { return null; } }) .then(function() { console.log("Logged in!"); return new Promise(function(resolve, reject) { this.page.property('onResourceRequested', function(requestData, networkRequest) { //This event is fired 40 times, only one is interesting to me the one that has the text maps.json in it if (requestData.url.indexOf('maps.json') !== -1) { //This if clause is entered only once like 10 seconds after "Logged in" console log and after being fired like 35 times for the other requests resolve({headers: requestData.headers, url: requestData.url}); } }); }); }); .then(function (data) { //This then block is never fired if (data) { console.log(data); request.get({ uri: data.url, headers: data.headers }, function(err, res, body){ if (!err) { callback(null, res.headers); } else { console.log("Error getting data from URL: "+ err); callback(true, null); } }); } }); There must be something wrong with the second last returned promise because the last then() is never fired although I can see that if (requestData.url.indexOf('maps.json') !== -1) is accesed once if I add a console.log inside...I am stuck in this for two days now..can someone help me?

Submitted July 21, 2017 at 09:27AM by jaitor

Thursday 20 July 2017

[Help] Remote debugging node on a Vagrant VM with VSCode

Hi all,I'm currently trying to get vscode setup to attach to some node code running on a vagrant vm.Versionsnode v7.10.1vscode 1.14.1vagrant 1.9.2Relevant ConfigurationVSCode Launch Configuration { "type": "node", "request": "attach", "name": "Attach to Remote", "address": "localhost", "port": 15858, "localRoot": "${workspaceRoot}/apps/api/", "remoteRoot": "/opt/gg/apps/api/", "protocol": "inspector" } Node Launch Command (on VM) node --inspect-brk=5858 src/db/transactions/households/.create-for-user.test.js Error from VSCode when Trying to AttachEnsure Node was launched with --inspect. Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: read ECONNRESET). If I try to telnet to the debug port on the VM, it seems fine, but if I try to telnet to the port from my local comp, it closes with: Connection closed by foriegn hostAnother important thing to note is that I have that port passed through to my local comp through my Vagrant config (but offset by 10000) so should be localhost:15858I know I had remote debugging working at one point (before inspector was the default debugger) but i'm unsure of what i'm missing here. Please let me know if you all have any good tips in trying to pull this off.Thanks

Submitted July 21, 2017 at 01:49AM by jjohnson338

Newbie Question: User Input

Hi everyone!Is there any simple solution in node for user input?I mean, a simple, structured-like way to wait the user type anything on console, like pascal's read(var)or C++'s cout?The only solutions i've found were difficulty to me and seems to be complex for what i want to achieve (simple CLI app).

Submitted July 21, 2017 at 01:14AM by the_vico

Node v8.2.1 (Current)

http://ift.tt/2ugfw0W

Submitted July 21, 2017 at 01:26AM by dwaxe

An alternative to relative imports (feedback requested)

http://ift.tt/2uffh4O

Submitted July 20, 2017 at 11:18PM by amallavarapu

Great recipe with several different packaged solutions to send emails using Node.js

http://ift.tt/2uLas6k

Submitted July 20, 2017 at 10:57PM by thewwfguy

Can you use node to create a java compiler on a website?

I am making a java and c++ tutorial website and I want to add a feature where people can test code, or possibly give them a challenge to do. Can this be done with node? If not, any idea what I would have to use? Thanks!!

Submitted July 20, 2017 at 09:35PM by chris_munley

Omelette is a simple, template based autocompletion tool for Node projects with super easy API. (For Bash, Zsh and Fish)

http://ift.tt/10gYJRp

Submitted July 20, 2017 at 08:14PM by Saltones

Blockchain command-line interface built with Node.js.

http://ift.tt/2uG07Ie

Submitted July 20, 2017 at 05:55PM by codeindie

Say hello to HTTP/2 for Node.js Core – Hopefully

http://ift.tt/2tJIEdB

Submitted July 20, 2017 at 06:47PM by justintimecoder

Node.js Top 10 Articles (v.July 2017)

http://ift.tt/2uMMJD0

Submitted July 20, 2017 at 05:56PM by itsawesomeday

Create a "Serverless" Music Recommendation Engine With Node.js and StdLib

http://ift.tt/2udUhwO

Submitted July 20, 2017 at 03:51PM by J-Kob

Nextract: An ETL Platform That Uses Node's Streams

http://ift.tt/2uLvvph

Submitted July 20, 2017 at 04:23PM by chadauld

Promises to async/await

Is there a way to "compile" my es6 promise code to the new es7 async/await? I have seen compilers online before that turn es5 code to es6. I have a large code base and need to convert from promises to async/await, but it will take a while to do it manually.

Submitted July 20, 2017 at 03:54PM by Flame2057

Keeping database models in their own module?

I have an express app that defines multiple db models using mongoose. I'd like to make some small command line apps that also modify the database. It seems like the best approach is to put all of my database logic in a local module - http://ift.tt/2uFxH0Q anyone know of any projects I can review that do this? I'm looking for code examples. Alternatively, is there a better way to share db code that I'm not thinking about?

Submitted July 20, 2017 at 03:06PM by fyzbo

Best way to delete undefined values from an object

Hi!I need a way to delete undefined fields from an object.What is the best way in terms of efficiency?I found this trick to do that, but I am wondering if there is a better way:var person = { 'first_name': 'John', 'last_name': 'Johnson', 'address': undefined, 'job': null, } person = JSON.parse(JSON.stringify(person)); // <- what i'm using now => { first_name: 'John', last_name: 'Johnson', job: null } Thanks!

Submitted July 20, 2017 at 02:55PM by honestserpent

Work with mariadb

Hi guys, I'm working with mariadb and mariasql (the node package to work with maria) I've had an issue I couldn't figure out, when I connect to a schema I'd created the error I got back was: "the database does not exist" but I could see it on the mysql workbench. Any idea?I've solved it changing to mysql package and everythig works fine, why?

Submitted July 20, 2017 at 01:46PM by Fran_29

A RESTful API using Node and Typescript

http://ift.tt/2vFlOFz

Submitted July 20, 2017 at 01:50PM by GreenMonkeyBoy

Functional Testing of Web Applications using TestCafe and NightWatch - x-post from /r/javascript

http://ift.tt/2ghpgBr

Submitted July 20, 2017 at 12:47PM by krylovanatu

JSHeroes 2017 | Liran Tal - Node.js Security: Breaking The Loop

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

Submitted July 20, 2017 at 11:34AM by ginger-julia

Care to code review a basic Express app I made?

http://ift.tt/2tJ38mN

Submitted July 20, 2017 at 07:22AM by burnaftertweeting

Wednesday 19 July 2017

The latest MongoDb hosted offering boast a free tier and encryption at rest, pretty cool!

https://www.mongodb.com/cloud/atlas/lp/compare/compose

Submitted July 20, 2017 at 05:43AM by justintimecoder

Node v8.2.0 (Current)

http://ift.tt/2vDXG63

Submitted July 20, 2017 at 01:26AM by dwaxe

Question about multiple async http calls

i'm fairly new to node and trying to push a bunch of documents up to AWS CloudSearch. I have 17 batches to send and I'm concerned about firing off 17 async http post calls at the same time. Does node manage things to not bog down the server, or do I need to manually build a queue to limit the number of calls going at one time?Likewise for downloading, I have to download over 400 files via GET. I built a queue using an EventEmitter to run them serially because I was worried about saturating the net connection and hitting the source server with a ton of requests at the same time but I'm guessing there's a better way.I'm using Node 8 and using async/await where I can.

Submitted July 19, 2017 at 11:29PM by Catalyzm

Forward incoming SMS messages to email with Node.js, SendGrid and Twilio Functions

http://ift.tt/2tHWAVm

Submitted July 19, 2017 at 11:31PM by philnash

how come next() isnt called when external middleware is used?

app.use(bodyParser.urlencoded({ extended: false }));How does express know to move to the next middlewhere after this line? Is it because external middlewares like body parser calls next() internally?

Submitted July 19, 2017 at 07:42PM by gamesdf

GroupMe Bot that Responds to a Specific User

I've been tweaking a copy of the GroupMe Node JS sample bot provided here, and I'm trying to create a simple bot that responds to one particular user in my group chat every time he says a certain word. I was able to tweak it to respond to the word, but I have not found a way to only have it respond to a certain user. The relevant code is located in the file "bot.js." The section "function respond()" contains the default trigger text for the reply (This is the original code, my only modification was replacing "/cool guy" with the new word)function respond() { var request = JSON.parse(this.req.chunks[0]), botRegex = /^\/cool guy$/; if(request.text && botRegex.test(request.text)) { this.res.writeHead(200); postMessage(); this.res.end(); } else { console.log("don't care"); this.res.writeHead(200); this.res.end(); } } Is there a line I can add to "function respond()" to check for the username as well as the text?

Submitted July 19, 2017 at 06:19PM by CCFM

Confused on where to go with learning Node

My introduction to node was Colt's Web Developer Bootcamp course. After doing that and feeling relatively confident, I decided to continue with Learn Node course by Wes Bos. After only a few videos I realized that the way Node was written in those two courses was very different (I'm guessing that's because Colt's course is older). I also dislike the fact that Wes' course includes so many files that he wrote before the course, making me feel kinda lost and not very competent. I'm about 15 videos in and I feel like if I started writing a new website myself, I wouldn't be able to transfer those skills because I don't have the same helper files that he wrote.After that I decided to check some other resources for learning Node. Most of them were older so I'm worried that they'll be outdated just like Colt's course (which I'm not even sure if it's outdated because my only Node experiences are those two courses).What are your opinions on this? Where do I go from here? Thanks for reading.

Submitted July 19, 2017 at 05:53PM by bsp952

Why won't node show syntax error location?

I thought they would have fixed this by now, but when I require a JS file that happens to have a syntax error in it, node, and specifically the vm.js file says that the line where I require it has the syntax error. That is totally unhelpful to the developer. Is there a work around to show the exact line the syntax error is on in the file? I've tried process.on('exit', function(e) { throw e }); but it seems that that function is never even called. Why wouldn't they add this by now?

Submitted July 19, 2017 at 05:00PM by Flame2057

Newbie Code Review

Hey guys, I'm a newbie to node/js and my first (and most fun ) project is making a discord bot with node. It's gone decent and the bot doesn't seem to have nearly as many issues as it used to, but I can't figure out how to make it better, yet.I'm gonna post a few command files here that I feel like aren't that great, can you review them for me and explain what I could do better? Be warned, it's a bot based around shitposts and memes.Command Name: AnnoyUse: Annoys a target user, or yourself if you forget to target someone.Potential Problems? This code feels repetitive and ugly, and I'm not sure how to make it better.Code: http://ift.tt/2uJd8BA Name: TweetUse: User can send a tweet from the memebot's accountPotential Problems? The command feels slow and buggy, but I can't figure out whyCode: http://ift.tt/2vjtTA2 Name: app.jsUse: This file handles incoming messages, and a few other things.Potential Problems? I'm just not sure about my code style here, (I like no semicolons though), basically I just don't know if what I'm doing is actually good practice and best for performance. I feel like I'm not using async/await to it's full potential, and sometimes the bot seems to leak ram and it would probably come from this file.Code: http://ift.tt/2uJ27jr you could help me learn by giving me an honest review/advice, I'd really appreciate it! <3

Submitted July 19, 2017 at 04:41PM by Kerdaloo

What tutorials are you interested in learning?

I am creating a small Node.js library to make it easier for developers to get started with Node.js and to become more productive myself. While creating this, I am also making tutorials to explain how to do things.So, what are you interested in learning? I've made a REST API design with a TODO list, a spreadsheet-to-db webapp and I am making a realtime chat as well.

Submitted July 19, 2017 at 02:18PM by franciscopresencia

Upcoming Node.js, Microservices & Security Trainings in Europe

http://ift.tt/2tGKewS

Submitted July 19, 2017 at 02:57PM by hfeeri

Need tutorial for calling external APIs

All the tutorials I can find for nodejs only show how to start a simple server with some REST-API's for the frontend and how to get data from the DB.But what still don't know how to do is how to collect data from external API's via the nodejs server. What I mean by that: I want to fill the DB with data from multiple Social Media Platforms. Calling several API's multiple times every second (or some other interval) for some real time statistics. Are there any tutorials that teach how to call other API's from nodejs infinitely? Or what keywords should i use while searching?

Submitted July 19, 2017 at 11:40AM by ahjaok

A fancier rm -rf node_modules && npm install

http://ift.tt/2uHxbAf

Submitted July 19, 2017 at 10:39AM by sethholladay

Redux-First Router data-fetching: solving the 80% use case for async Middleware

http://ift.tt/2tF79sm

Submitted July 19, 2017 at 09:08AM by FaceySpacey

Tuesday 18 July 2017

Bluetooth LE with NodeJS

Hi, I am attempting to design a desktop app with NodeJS & Javascript which can connect and communicate with Bluetooth LE devices. Currently, I am using the noble package but that requires a USB Bluetooth 4.0 Device. Is there any way to do it without it, and how would you recommend one going about doing it?

Submitted July 19, 2017 at 05:24AM by balitimore

How to run Node.js as a background service

http://ift.tt/2uxQknP

Submitted July 19, 2017 at 02:55AM by thewwfguy

How to build an express server to work with react?

What architecture do you typically use for the whole application? If I make a server that sends JSON data to a server that then renders it will that compromise the security?

Submitted July 19, 2017 at 12:45AM by borisvasilev

How one senior developer at Cars.com convinced the entire company to do a full migration to Node.js

http://ift.tt/2tCpXsg

Submitted July 18, 2017 at 08:48PM by dankqu

Can anyone tell books to learn Nodejs ?

No text found

Submitted July 18, 2017 at 08:39PM by alokrao

Best and most reliable module for extracting a .tgz?

As the title says.

Submitted July 18, 2017 at 05:48PM by OzziePeck

Writing a Node.js module in TypeScript

http://ift.tt/2vebxk9

Submitted July 18, 2017 at 03:38PM by brokentyro

How Cars.com Developer Mac Heller-Ogden Convinced His Bosses to Adopt Node.js

http://ift.tt/2tCpXsg

Submitted July 18, 2017 at 04:17PM by dankqu

Node.js rapid upskill

I am an experienced ASP.NET developer. Currently I am working on an inherited and very poorly designed and implemented .NET MVC site that needs to be rebuilt, especially the back-end.Our senior solution architects are pushing heavily for using node.js to create RESTful api microservices for the back-end while initially leaving the front-end largely untouched. The idea is to gradually move towards something resembling the MEAN stack, but there is still a lot of analysis that needs to be completed to determine the most appropriate solution design.Now, conceptually I have no issue with using something like node.js. I've been interested in it for a while and completed some beginner tutorials online, but that the only experience I have.I know it depends on a myriad of different factors like the complexity of the app and the individual developers level of overall competence, but what is the feasibility of going "YOLO: I'll figure it out as I go along and I'll be able to deliver an initial (if not yet necessarily complete) product within a month or two". I'll be going at this completely solo.

Submitted July 18, 2017 at 04:27PM by carelnel

Fixtures for MongoDB - Load and Unload your (test) data

I wanted to share a tool I created to load and unload mongodb collections. It's called node-mongodb-fixtures.Basically, you create some json files. Each file is a collection that contains an array of documents. node-mongodb-fixtures uses those files to load and unload the db. (note: has both a lib and cli form)Please share feedback. I will continue to improve it. Hope you'll find it useful Check it out here: http://ift.tt/2u64onA

Submitted July 18, 2017 at 04:38PM by coracarm

A set of best practices for JavaScript projects

http://ift.tt/2sj545H

Submitted July 18, 2017 at 04:43PM by vahidpg

Best way to translate a web app withe Node

Hello, i've got an app built with HTML, CSS, jQuery, Node, and VueJS. I need to translate it in different languages (fr, en...). I could not find some tips or packages about this. Do you have any experience with it ?

Submitted July 18, 2017 at 03:09PM by tazeg

Hardware Hacking for JS Developers

https://www.youtube.com/watch?v=MntxG61_3CY&feature=youtu.be&t=8

Submitted July 18, 2017 at 02:20PM by pimterry

[HELP] MVC with Express Generator

Hey all,I'm looking for any and all clarification, assistance, and/or resources to use as a newbie when trying to follow the MVC pattern while also using Express Generator.As this is Reddit I fully expect someone to correct me if I state something wrong, in fact I look forward to it.To my understanding when using Express Generator the app structure provided doesn't really use the MVC pattern. My logic pretty much lives with my routes. I'd need to add a controllers folder to handle the interactions with the models? Also, is this where business logic should be kept as well?I guess my question is when i have a structure like Express Generator and then throw in controllers, what logic should live where? What about my routes?I know this is super vague and probably subjective in nature, but i appreciate all feedback.

Submitted July 18, 2017 at 02:23PM by therealhenrywinkler

Npm strikes back with v5

http://ift.tt/2tmf829

Submitted July 18, 2017 at 12:30PM by justintimecoder

Creating a website, need help with functionality.

Hello,I'm creating a website where we get information about our clients from a third party and then present it to the client via our website in a refined way. The way this information is to be shown is through a moderator who looks at the third party information (on our website), edits it and then posts it to the users profile. How would you implement this?Would really appreciate help, I'm pretty new at this.

Submitted July 18, 2017 at 10:16AM by Sirzorre

How to host a NodeJS app in Windows VM for production?

I am tasked with hosting a NodeJS app across several Windows VMs in a load balanced manner. The Windows VMs are already existing and hosting other websites through IIS. What are my options to host them in all these VMs and load balance them?

Submitted July 18, 2017 at 09:42AM by argumentnull

Beginner question about default packages

Hello, if i want to use "fs" or "http" do i need to "npm install fs" and "npm install http" ? what does it install ? http://ift.tt/2uxOCT5 http://ift.tt/2vwZ4r7 Thanks.

Submitted July 18, 2017 at 09:50AM by tazeg

Using Node to act as a middleman between browser and mongoDB

Hey there,I've never used node before and a bit stuck. I'm trying to populate some graphs in a browser using data in a mongoDB collection. I've read around and using Node to assist with this seemed the way to go. I am a bit unfamiliar with how it works and was hoping for some hints.var http = require('http'); var client = require('mongodb').client; var url = "mongodb://*removed*"; client.connect(url, function(err, db) { if (err) throw err; var query = {id : "*removed*"}; db.collection("*removed*").find(query).toArray(function(err, result) { if (err) throw err; console.log(result); db.close(); }); }); I found this example online and is working fine. I'm a bit confused by two points:Does this file sit on the server with the Db and I just call this file?How can I alter query so that I can search whatever I want from the browser and have it return?I'm still searching for solutions on the second one but I'm not sure how the node file is situated. Any help would be appreciated.Thanks!

Submitted July 18, 2017 at 08:43AM by Fluroblue

Monday 17 July 2017

Hosting issues with Passenger, NodeJS, Sequelize & sqlite

Multer is upload blank files without an extension

I took a form field that is for uploading pdfs, made it where its now not required, and when I submitted the form without uploading a file in the form, multer makes a random named file eg. "DN0D__taLilNBsAJz_whVO5Y" and uploads it to the uploads directory. Any reason why this happens?

Submitted July 18, 2017 at 02:58AM by InsertCoinPushStart

What are some interesting/fun things I can do with node as a new user?

I've payed with node/express/pug and made a basic API app. Trying to become proficient at node, and was wondering if anyone knew any cool functions or npm packages or anything at all really.

Submitted July 18, 2017 at 12:33AM by roharia

How can we apply Genetic algorithm and machine learning with Node js ?

Title

Submitted July 17, 2017 at 11:14PM by cthuluhoop123

Last Week in Node.js Working Groups - July 10th

http://ift.tt/2uwGphR

Submitted July 17, 2017 at 11:05PM by _bit

rt_lite: My first node app that lets you quickly see movie ratings. Feedback appreciated!

https://rtlite.xyz

Submitted July 17, 2017 at 09:18PM by mister_brown

Running node --inspect in production??

Wondering if there is a downside to running node.js in --inspect mode? I know there is an open port, but lets assume the port is not available for general connection. Are there any performance degradations if node was started in debug mode?

Submitted July 17, 2017 at 08:35PM by ScopiNC

API Authentication with Node | #3 - Node/Express API

https://youtu.be/x_HRoXKo2es

Submitted July 17, 2017 at 06:43PM by eXtremeRR

Organize - a command line tool to help organize your files in an instant (written in node)

http://ift.tt/2vapfEA

Submitted July 17, 2017 at 06:56PM by manrajsinghgrover

What's New in Mongoose 4.11: useMongoClient

http://ift.tt/2uvHWVq

Submitted July 17, 2017 at 07:04PM by code_barbarian

Best way to unit test database access?

I keep hitting up against this, and I keep thinking that there must be a solution to this. So, here goes. What are the recommended ways to unit test your DAO code?Specifically, how do you test that your code is executing the correct SQL, getting back the expected values from the database, and generally doing the right thing?The examples that I keep finding all have problems with them:Don't bother - acceptance tests will cover it. All well and good if you have good acceptance test coverage, but even then you're leaving until the last minute something that could be done earlierRewire / Proxyquire / etc the database module (e.g. pg). This works, but it often assumes that you're using pg directly in your DAO code and not going through some intermediate layer. (I've got a module of my own that exposes a single query method which does logging and returns the result as a Promise). Yes, this module could be Rewire-d but then how do you test this layer? This also means that you are asserting on the exact SQL string, which has problems if you are using some tool like Squel.js that writes it for you.Run a real database to test against. This implies that every developer has the database running locally, and if you're not careful you get leakage between tests which is very bad. I could do this using Docker - I do that already for acceptance tests - but it then means that unit tests can only be run from Grunt, not from the IDE.My current thinking is that 2b is the best that can be achieved, but it feels like it should be possible to do better.

Submitted July 17, 2017 at 05:14PM by sazzer

Fetch examples for a CRUD app?

I'm finishing up a CRUD application and have come to the stage of implementing the update and delete functions on the front end (the routes are already complete). I'm not using a framework and I'm really struggling with how to write this part. Fetch seems to be the most simple way, but I haven't seen any direct examples (so much Angular...) and I'm having a hard time figuring out how to write the requests. I've read the documentation on MDN, but I guess I'm just not grasping how to apply the specifics. Can anyone point me in the direction of some specifics for PUT and DELETE requests?

Submitted July 17, 2017 at 02:44PM by flight19

npm 5 and file: URLs – Alex R. Young

http://ift.tt/2thNvT9

Submitted July 17, 2017 at 10:25AM by katerina-ser60

11 Javascript/Node.js Project Survival Tipps

http://ift.tt/2t4giLw

Submitted July 17, 2017 at 11:09AM by sebs303

A yeoman generator for node modules

http://ift.tt/2ti3iGk

Submitted July 17, 2017 at 09:42AM by cesarferreira

My 20+ best practices on running Node in production

http://ift.tt/2u0uTcl

Submitted July 17, 2017 at 09:47AM by yonatannn

Looking for backend dev

http://ift.tt/2uq9RGD

Submitted July 17, 2017 at 08:45AM by luka_obuljen

Dynamic CSS using handlebars values?

Hey guys, sorry if this is a bit of a noob Q. I'm a beginner to html/js/css.I'm trying to create a HandleBars template of a crowdfunding thermometer. My problem is that I need the dynamic value to determine the width of the progress bar inside the Handlebars template, which requires CSS. I'm confused about the concept of dynamic CSS or whether it's possible.Effectively, the progress on the thermometer is based on an aggregated value called from Google Sheets, which is plugged into HandleBars.I need the width of the 'progress' div to be equal to percComplete.Javascriptvar RBITemplate = Handlebars.compile($('#team-rbi-template').html()); $('#total').sheetrock({ url: mySpreadsheet, query: "select sum(B)/100 where (A = 'Donate $2 to Test Campaign')", labels: ['percComplete'], rowTemplate: RBITemplate }); Handlebars HTML template - here's where I'm stuck

Sunday 16 July 2017

Interesting solution to perform long-running computations using WebWorkers API while still responding to new requesets

http://ift.tt/2upkDwI

Submitted July 17, 2017 at 02:18AM by thewwfguy

AJAX security in Express?

So for a personal app I'm writing I'm using express with auth0 for authentication (why reinvent the wheel?) and passport for authorization.There is a part of my app where I'd like the user to be able to POST via AJAX. I'm using fetch to send the POST request to the appropriate route and it works fine and dandy.My issue is that anyone can access this route. I've set up some really basic but easily broken protection inside the route, but I don't think that is good enough. Essentially, I'm just checking that the request is referred from within the app.However, this doesn't check that the user is logged in, and it uses the current user id being passed down from the server to assign the content created by the POST request as the owner of the content. So anyone with a working knowledge of the system could theoretically assign new content to anyone's account so long as they know the user's id.I tried setting up ensureLoggedIn as middleware on my router for the associated AJAX route. But since the client is passing the request via AJAX it doesn't have the token passed along with it...resulting in the AJAX request being redirected to the login page.I've been googling for days and haven't figured this out. Anyone here who can help?

Submitted July 17, 2017 at 02:19AM by burnaftertweeting

Receive & Parse E-Mail

I'm searching for something that'll let me monitor a personal e-mail account of mine so that when new mail comes in, I can parse the content for use in my code.

Submitted July 17, 2017 at 12:07AM by EVILGHO5T1

Why do people hide all class variables behind getters?

I have seen the following pattern several times:class Cat { constructor(id, name, species) { this._id = id; this._name = name; this._species = new Map(species); } get id() { return this._id; } get name() { return this._name; } get species() { return this._species; } } I understand that this is implying that id, name, and species are supposed to be read only. However at the same time, it just feels like it bloats the code. I can understand if your creating a getter for a case where you are computing the property value on the fly.However is this really that much better than this:class Cat { constructor(id, name, species) { this.id = id; this.name = name; this.species = species; } } I am going through code where a class has 15+ getters for nothing other than properties passed into the object, which feels like a huge waste. Is there some better reason for this?

Submitted July 16, 2017 at 08:20PM by frankimthetank

Real time online users on google map(feedback is welcome)

http://ift.tt/2unp23u

Submitted July 16, 2017 at 12:28PM by smoqadam

Say hello to HTTP/2 for Node.js Core

http://ift.tt/2tSxCpJ

Submitted July 16, 2017 at 11:11AM by codedesi

How to structure your Node.js application: The 7 keys

http://ift.tt/2s3LXw1

Submitted July 16, 2017 at 09:44AM by harlampi

Noob question, sequelize

I am trying to use sequelize in a pretty simple setup, but I am making sure there isn't a better way to achieve what I want to achieve.models.prices.findOrCreate({ where: { price: product.price, sourceId: ???, productId: ??? } }); In this scenario both sourceId and productId are foreign keys. Both of these keys have to be queried. Currently I have a (what I feel) is a bootleg way of fixing this issue, I have multiple nested findOne queries. This looks ugly and doesn't feel elegant.So, my question is: Is there a better way to access the sourceId and productId without nesting a ton of these queries?productId would need a query searching for SKU and retrieving ID in model productssourceId would need a query searching for a string and retrieve the ID in model sourcesSorry if this seems like a dumb question, I just come from a Django background. This is usually pretty basic/built-in stuff, making sure I am not missing something.

Submitted July 16, 2017 at 09:50AM by Miles360x

Saturday 15 July 2017

How do I get an OAuth 1A token from my node app?

I want to use the tumblr api in my node app, and need OAuth 1a to authorize. The official tumblr node library requires an existing Token and Token Secret, so I need to request one. I checked out node-oauth, but it doesn't seem to have any (documented) way to get a new OAuth 1 token. I've spent a few hours trying desperately to figure out how to get a new token for a user.My goal is to retrieve a URL for this sort of page which I can open in the user's browser, which should then send a request to my API callback containing the token, but I'm completely lost. Could somebody point me in the right direction?I've tried this code, which I thought would result in the token being sent to my callback URL, but the logs on the server I set up to receive the callback show absolutely nothing. (And, in retrospect, I completely ignored the fact that the user needs to see an authorization prompt in their browser for this to work.)const oauth = require('oauth') const oa = new oauth.OAuth( 'http://ift.tt/1e3TrA7', 'http://ift.tt/Lohona', '< the consumer key >', '< the consumer secret >', '1.0A', null, 'HMAC-SHA1' ) oa.getOAuthAccessToken('', {'grant_type':'client_credentials'},(e) => {console.log(e)})

Submitted July 16, 2017 at 06:33AM by _tague

Critique my micro-service setup

I'm making a nodejs app with basic auth functionality, and I decided to build it with a micro-service approach.Infrastructure: Digital oceannode1: { nginx-loadbalancer + nodejs-app } node2: { nodejs-app } node3: { database }It's pretty barebones, but it definitely works. It allows zero-downtime deployments since the load balancer will redirect traffic to the working nodes. And during heavy load, I can easily spin up more nodes.Is this a good setup? What's the reason to use kubernates etc? The reason I haven't used docker is because pm2 does the same thing, I just need to do a somewhat longer (still easy) setup. I don't think the docker-swarm autoscaling works with the digital ocean API either.

Submitted July 16, 2017 at 02:46AM by omgitsmalaa

Travis CI unmet dependencies

Greetings,When I link Travis CI to my github repo, it says unmet dependencies for mongo. When I remove all the dependencies locally, then push changes, Travis is happy. Any idea what this issue is?Thanks in advance.

Submitted July 15, 2017 at 11:27PM by askholeprojector

Node.js Express MongoDB Tutorial

http://ift.tt/2s0pOis

Submitted July 15, 2017 at 07:36PM by KrunalLathiya

Simplifying route definitions using Express Router

http://ift.tt/2vonNxV

Submitted July 15, 2017 at 05:28PM by funJS

4 month journey (relatively new to coding in general)... how's my syntax?

Hey r/node, I've been trying to code for at least an hour a day ( sometimes i spend entire weekends in front of my laptop, and other times I don't write code for weeks...) Cutting to the chase, I'd like to know how my syntax is after 4 months of learning/practicing... minimizing bootstrap: Any feedback would be greatly appreciated. function foo() { return new Promise(function(resolve, reject) { var resObj = {status: false} if (A) { resolve(resObj); } else { var _metaA = {data_A: someData} if ((B && C) { if (C) { resObj = {status: true, metaA:_meta, metaB: someOtherData} resolve(resObj); } } else if (!B && C)) { resObj = {status: true, metaA:_meta}; resolve(resObj); }) } resolve(resObj); }); }

Submitted July 15, 2017 at 04:00PM by DepressedHypeman

How do I start in this pile of unsorted Javascript frameworks and tutorials?

I am a young and new web developer and I got super interested in Node and how it uses javascript for the backend and generally speeds up web apps and a million of other benefits of learning it. But I just cannot grasp one thing - where the hell do I start? We got front-end frameworks, back-end, front-end and more back-end.I have previously self taught myself C++, C#, Java and they are all straightforward, with their own libraries and apis. But with Node it's a whole different story, let's say I pick React for the front-end, then what the heck do I pick for the back-end? The old articles suggest, that, the newer ones say that use whatever you want. But how can I choose, if I am in a room with a bunch of books, that cover pretty much the same thing in their own unique way.tl;dr - Frustrated with the insane amounts of content and frameworks for Node and looking for an answer on where to begin in this mess.

Submitted July 15, 2017 at 02:53PM by PaulyTime

How to use MERN stack?

How exactly should one wire React with a Node js server? I have created only apps using Express with a view engine like Pug or Handlebars and I have no idea where is the place of React in the whole thing. What is its purpose? Do I use it instead of the view engine?

Submitted July 15, 2017 at 02:48PM by borisvasilev

Pusher-client ping pong

I want to use the ping-pong to check latency, how can I send the server a ping-message? (if I am not mistaken, he should reply with pong then, right?)

Submitted July 15, 2017 at 12:42PM by cephii2

http2: Introducing http/2 by jasnell · Pull Request #14239 · nodejs/node

http://ift.tt/2toOt02

Submitted July 15, 2017 at 12:16PM by tuananh_org

Integrating OpenWhisk with Your Node Application

http://ift.tt/2rzetZh

Submitted July 15, 2017 at 11:04AM by ms-maria-ma

I released my first Node Module - hope it is helpful for someone else too

http://ift.tt/2vmcVQZ

Submitted July 15, 2017 at 09:17AM by Chlorophyllkid

Made a simple Express + GraphQL boilerplate with server-side HMR.

http://ift.tt/2tdv1YF

Submitted July 15, 2017 at 09:20AM by cutcopy

Express vs Loopback. Help me i am Stuck.

Hey we are starting to create this application for our startup and this is going to be our MVP. So the stack we were going through was Node(Express) + Angular + SQL. The problem arises when we start looking for ORM for Express - SQL. And then developing Authentication , Authorisation Module and then comes API's. Suddenly we found this miracle baby the solution of everything Loopback. But then i realize nobody in our team has worked on it. We are ready to learn for sake of development but we want to be sure that it is what they are saying it is. So if anyone has any knowledge regarding Loopback and Express in production feel free to express his/her views. You are providing a lot of values in our life so thanks for it already. And if you have worked on it already so plese guide to some good resources for learning.

Submitted July 15, 2017 at 08:40AM by dprophecyguy

Friday 14 July 2017

Is using module.exports for a singleton a bad idea?

Trying to get a better handle on nodejs, i am wondering is this a bad practice?Bascially i have something similar to this:// services/foo-service.js class FooService { constructor() { } doSomething() { // does something } } module.exports = FooService; // services/index.js const FooService = require('./foo-service'); module.exports = { foo: new FooService() }; // in some other file const services = require('../services'); const bar = function bar() { services.foo.doSomething(); } Is this an okay way to export and utilize the service as a singleton?

Submitted July 15, 2017 at 06:05AM by frankimthetank

So much information. Nodejs has been fun, but exhausting. Help.

Been creating some basic projects with node.js and all it's fun packages. I really need some advice. There is SO MUCH INFORMATION. WUT DO?I'm just having a tough time making myself employable. I'm following the tutorials and such. Only to find out lots of them are bloated and not even close to production standards...There is too many scrubs putting out tutorials and it's making learning tough. I remember playing with c++ back in 2009 and it was pretty straight forward and great tutorials (at the time).My point is this: Can you give me some ideas what I NEED to be learning to get a job in this industry?Its' friday and i'm drunk and high trying to learn programming.love it so far. Back in the day I used c++ and contributed as much as i could on an open source project. I had an absolute blast with the team and tech. I get that same feeling with web dev, but the crazy amount of information and rapid pace makes it discouraging.TLDR; Web dev is wild. Miss late 2000s. Help with backend information please?

Submitted July 15, 2017 at 06:06AM by WonxyTime

Graceful shutdown in Node.js made easy

http://ift.tt/2tpMyYX

Submitted July 15, 2017 at 06:23AM by sethholladay

Any good SSH libraries? Something closer to fabric for python?

I was wondering if there was a good high level ssh library for nodeJS? Something similar to pythons fabric.I have been looking at the ssh2 library however using it feels really awkward and just not very nice to use.Node-ssh offers a nicer promised based API, but it really and i mean really struggles when doing 5+ tasks at once (seems to just hang, or starts throwing random errors mid tasks). With fabric i could do tasks on 50+ hosts at the same time.

Submitted July 15, 2017 at 05:11AM by SonOfSpades

[Question] Seeding MongoDB with gridfs-stream

Good evening everyone,I'm working on a project where I want to pull files into the database via a file upload form through the browser (in the future state). At the moment though, I want to upload three images that I have right now into the database so that I can start working on how I'll display those images on the page.Is there a good way of seeding a database with gridfs-stream, gridfs, mongo-gridfs, or any other form of gridfs. I'm running into a lack of understanding of where to specify the file path that I want to use for the specific file unless there's a pick in a form.

Submitted July 15, 2017 at 03:00AM by randygbiv

Scope is a Facebook Messenger bot that identifies songs from lyrics/titles

http://ift.tt/2uiWdVW

Submitted July 15, 2017 at 03:10AM by jch254

Get local IP address in node.js

http://ift.tt/2t0retv

Submitted July 15, 2017 at 12:49AM by thewwfguy

pm2 nginx load-balancing shows all calls on all servers?!

Redis and Node Part 4/4: Lua Scripting

http://ift.tt/2unVcvl

Submitted July 14, 2017 at 11:21PM by nucleocide

Is there any good node.js module for scheduling time on calender?

I have heard timing/scheduling etc can get complicated. I am trying to find out if there are any modules that makes scheduling easier - before heading to implement one for my hobby application.

Submitted July 14, 2017 at 08:12PM by reddit_user_---_---_

[Question] How do i check my latency with pusher-client?

I am listening to a socket of a marketplace, and am trying to get my software running on a VPS as close as possible.But I have no idea of how to check the latency.Googling it didn't bring me too far :|Any ideas?

Submitted July 14, 2017 at 07:40PM by cephii2

What is Async Hooks in Node.js 8

http://ift.tt/2vlkcjQ

Submitted July 14, 2017 at 05:51PM by shsh3

Node best practices?

Coming from a Java background where everything had its place and there exists a rough standard for development for everyone, I'm kinda struggling to develop apps well with NodeJS.Now I must mention that I genuinely despise Javascript, but slowly I've been coming to terms with it - especially that I have no choice :P So as part of my conquest of Javascript I've chosen to focus on Node, Express, and Angular.So far I've been able to quickly develop an Express application with a SPA app on the front that pulls front-end dependencies(Angular and Bootstrap) from CDNS. NBD, pretty old stuff you might say!However now I want to do it better.SOOOO....How do I manage my front-end dependencies?Given there are many project structures, whats the most common?What's your Ideal development toolchain/process?Any other best practices?I'm sure they'll be lots on this one!cheers!

Submitted July 14, 2017 at 05:10PM by officialpatterson

JavaScript is just so expressive and fun these days

http://ift.tt/2uhPNGv

Submitted July 14, 2017 at 05:24PM by justintimecoder

Multi-tenant app security precautions

Hey guys, quick question for the experienced node people, regarding security:I have a multi-tenant app, and as a part of my sales process, I'm going to be providing demo accounts for potential customers. My concern is that from inside the app, they may be able to find exploits that would not otherwise be available to external hackers (who don't have a login). Do you guys have any best practices or reference articles in regards to how I could protect my app's data from someone who might use their demo account to try to hack my app or scrape data from other users?I know it's a bit of a general question, but any input is appreciated!

Submitted July 14, 2017 at 03:52PM by snahrvar

Nodejs Connection

Hey Guys,I coded a nodejs application and I want to authenticate the user via a network. Is it possible? If so how do I do it?Thanks in advance.

Submitted July 14, 2017 at 02:55PM by cgtech3

In 2017 do we need a sandbox for node development?

As title says, who uses a sandbox for node development? Not saying we should or should not be using one just genuinely curious to whether is it still needed.Be very interested to hear everyone thoughts :)

Submitted July 14, 2017 at 01:38PM by timkinbokeh

A Javascript interface to the (private) Starbucks ordering API

http://ift.tt/2tJVgoe

Submitted July 14, 2017 at 02:03PM by ratancs

Looking for charts library

Hello!I have always admired realtime web apps and now since I am working with Node.js for a while, I want to start making such apps. Now I am also huge fan on nice charts and dashboards.I am looking for "best" and preferably simple charts library so I can connect it with node/express/socketIO to show realtime data from MongoDB database.Any recommendations?Thanks!

Submitted July 14, 2017 at 12:40PM by xfrozenspiritx

Reverse Engineering One Line of JavaScript

http://ift.tt/2um7aGk

Submitted July 14, 2017 at 11:15AM by ratancs

Not receiving file from html form to Node server

I have a simple form like so:
Then within a script tag i have: In the console.log on the client side it is showing empty like so:data: {} On the server side i have this:app.post('/shopify/dashboard/about', function(req, res){ console.log("Data: " + JSON.stringify(req.body)) }); console.log on the server is also empty:Data: {} Can anyone help?

Submitted July 14, 2017 at 10:09AM by farhansyed7911

Node.js Weekly Update - 14 July: The best tutorials & new tools.

http://ift.tt/2uYrUkx

Submitted July 14, 2017 at 10:26AM by hfeeri

Async / Await and callbacks

Hi everyone,I'm trying to set up a simple async function that awaits messages from rabbit mq and then processes them. I'm having some trouble though. Below is an example.// listener.jsconst amqp = require('amqplib') async function newMsg(){ try{ const connection = await amqp.connect(${addresss}) const channel = await connection.createChannel() channel.assertQueue('queueName', msg => { let msgBody = JSON.parse(msg.content.toString()) channel.ack(msg) return msgBody }) }catch(e){ throw new Error(e) } } module.exports = newMsg I then have a seperate module consuming these messages and processing them;// someService.jsconst newMsg = require('./listener') async function listen(){ try{ let scrapeRequest = await newMsg() // ... do things with the message }catch(e){ console.warn(e) } listen() } Running someService.js doesn't seem to wait on a msg being produced. If newMsg() only returns once the channel.assertQueue callback fires, and newMsg being an async function means it returns as a promise, why is the code running to completion early?Are there any good examples of async / await with a message queue? It seems tricky to structure, especially if I try to ack messages outside of the inital newMsg function.

Submitted July 14, 2017 at 08:19AM by ajc820

Running a Node server on a Raspberry Pi with a physical button

http://ift.tt/2sWDKK8

Submitted July 14, 2017 at 08:22AM by katerina-ser60

How to serve static js/css files for Node.js using Nginx??

The static files are located in /home/user/xxx_static/public/ directory on the nginx server. Both nginx and nodejs are running on different systems. Here is the conf. for nginx-upstream project { ip_hash; server xxx.xxx.xxx.xxx:PORT; keepalive 64; } server { listen 80; server_name website.com root /home/user/appname_static/public location / { proxy_pass http://project; } } I am including the js files in the handlebars template like -In the app.js file in the Node app -app.use(express.static(path.join(__dirname, 'public'))); When I run my website the developer tools shows the GET Request like this for a file -Request URL:http://ift.tt/2t9Vfvf Status Code:500 Internal Server Error The files are not getting included when i run from nginx server but it works fine when i run the app directly from nodejs server. Please help as i new to nginx and trying to serve the static content of my website via nginx. :)

Submitted July 14, 2017 at 08:24AM by himugamer

Best practice: how to manage complex REST APIs?

Hello!I'm wondering what's the best practice for huge REST APIs, based on node?For now I'm using simply ExpressJS, but I'm repeating myself too often and it doesn't feel right. A automated documentation generator would be cool as well.What about frameworks like LoopBack? What's your advice?Thank you!

Submitted July 14, 2017 at 07:00AM by FattySuperCute

Thursday 13 July 2017

Preventing requests to non existent API routes node/express

Hi all,I've recently launched an application on node hosted through AWS.After checking logs there seems to be many requests to routes such as /MyAdmin. /phpmyadmin /admin/db.I'm assuming this is the work of bots attempting to find access points/vulnerabilities.I've attempted to research best methods to block these incoming requests but this is proving to be a suprisingly hard to topic to find guidelines for.If anyone could suggest methods to prevent these requests that would be much appreciated. Or even other suggestions to improve overall security for routes.Thanks noders!

Submitted July 14, 2017 at 05:22AM by joakimnoahsarc

Node.js devblogs

Hey node.js community, share blogs you're following related to node.js !

Submitted July 14, 2017 at 03:32AM by Polisas

Deploying a Node.js and MongoDB application in SAP Cloud Platform

http://ift.tt/2uWQjHj

Submitted July 13, 2017 at 11:34PM by juror-number-8

Redis and Node Part 3/4: Atomicity with MULTI

http://ift.tt/2sVqiXs

Submitted July 13, 2017 at 11:03PM by nucleocide

localtunnel exposes your localhost to the world for easy testing and sharing!

http://ift.tt/1L5uE1O

Submitted July 13, 2017 at 09:30PM by indatawetrust

Why Developers Are Moving to Yarn

http://ift.tt/2ueks7j

Submitted July 13, 2017 at 08:40PM by Saltones

What's the best way to monitor my production Node App?

Hi guys, I'm in the process of scaling out a software solution and to be honest, I still have a LOT to learn! So I'm reaching out to the experts here for some help.Specifically, what process/software/APM would you recommend for monitoring the health and performance of a production node app? On top of this, I welcome any of your general advice on best practices for managing a production app. Thanks!

Submitted July 13, 2017 at 06:52PM by snahrvar

Constant HashTable Seeds Vulnerability Explanation

http://ift.tt/2vhkTuB

Submitted July 13, 2017 at 06:25PM by aBamieh

Universal Now: Now, on Every Cloud - Zeit's Now can now also deploy to AWS, Google Cloud, and Microsoft Azure

http://ift.tt/2tPUIeW

Submitted July 13, 2017 at 03:19PM by enkideridu

TypeScript can be a great help to Node projects that want to scale

http://ift.tt/2t6TSO3

Submitted July 13, 2017 at 03:27PM by justintimecoder