Sunday 31 March 2019

Has anyone worked on micro payment server based on socket.io?

No text found

Submitted April 01, 2019 at 03:58AM by SumanJung

Query help!!! Please

Is there anything wrong with my query? I've been debugging past 5 hours and stil can't figure it out.https://pastebin.com/HAiVjN09The queries both work in pgadmin, both $1 and $2 return valid values in my logThe error im getting is "could not determine data type of parameter $1 at Connection.parseE" I've tried everything I could think of I've searched countless SO links but can't find an answer

Submitted April 01, 2019 at 02:52AM by NOT_COLBYS_ALT

Industry standard for website that uses its own private API?

The SetupI'm working on an eCommerce site for a family member. NodeJS backend, built with Express.Some of the routes are solely for rendering pages. Examples might be GET /about-us or GET /shop. Nothing fancy, no additional server calls needed.But then there are the other routes, that I refer to as "API Routes". These API routes do not render any content, and act exclusively for exchanging data between the frontend and backend - just like a REST API. An example might be GET /products/[productID]?q=20&f=120.The ProblemI have all the API routes in their own directory, and have built them all exactly like I would a public REST API - even though this is not a public API and its endpoints will never be used on any other site.One annoying issue I've run into has to do with sessions. A true RESTful API is stateless, and does not have a check for isLoggedIn, but some of the rendering routes do have this.There are a decent number of API endpoints for managing the shop and products and orders, so I'd like to keep all that functionality separate from the rendering routes. Additionally, having these API routes without rendering makes it super easy for single-page behavior (collecting/emitting data, checking status, etc).The QuestionWhat is the industry standard approach for a site like this? Will I go to hell if I don't make the API routes stateless? Is there a better way?Thanks for any insight!

Submitted April 01, 2019 at 03:06AM by rockitman12

How do I print this value?

This is my code. I want to print the value broadcasted on "console.log(info) (the console.log prints the correct number i wanted) but in the bottom IF statement. But everytime I run the program it says message is not defined.const Discord = require('discord.js');const { prefix,token } = require('./config.json');const client = new Discord.Client();//CoinGecko API Grabbingconst CoinGecko = require('coingecko-api');const CoinGeckoClient = new CoinGecko();let hello = `how are you`;//Grabbing API Responcevar pingGecko = async() => {let information = await CoinGeckoClient.simple.price({ids: ['bitcoin'],vs_currencies: ['cad']});global.info = (information.data.bitcoin.cad)console.log(info)const Discord = require('discord.js');const { prefix,token } = require('./config.json');const client = new Discord.Client();//CoinGecko API Grabbingconst CoinGecko = require('coingecko-api');const CoinGeckoClient = new CoinGecko();let hello = `how are you`;//Grabbing API Responcevar pingGecko = async() => {let information = await CoinGeckoClient.simple.price({ids: ['bitcoin'],vs_currencies: ['cad']});global.info = (information.data.bitcoin.cad)console.log(info)if(message.content.startsWith(`${prefix}test`)){message.channel.send(info);}}pingGecko()}}pingGecko()

Submitted April 01, 2019 at 12:23AM by rotaryfurball

In Pursuit of Enjoyable Developer Collaboration

https://dev.to/lostintangent/visual-studio-live-share-in-pursuit-of-enjoyable-developer-collaboration-2nko

Submitted March 31, 2019 at 11:54PM by lostintangent

Node.js Readable streams distilled (second edition)

https://micromind.me/posts/nodejs-readable-streams-distilled

Submitted March 31, 2019 at 10:34PM by iximiuz

You don't want to keep all of your eggs in one basket: razzle plugin (II)

https://nckweb.com.ar/you-dont-want-to-keep-all-of-your-eggs-in-one-basket-razzle-plugin/

Submitted March 31, 2019 at 09:56PM by nickcis

How to create a REST API with Express.js in Node.js

https://www.robinwieruch.de/node-express-server-rest-api/

Submitted March 31, 2019 at 08:26PM by r-wabbit

Preferred approach for passing contextual data around?

Hi,I’ll use a Koa app as an example, but the workflow seems to be the same for any call flow(I guess).In my app I have middleware that tacks on a correlation id at the beginning of the request.I’d like to log that correlation id in the controller. That’s easy, it in the context passed to the controller.The controller is now going to call a service, which will call a random microservice.I’d like to tack the correlation id as a header value on the call to the microservice. I’d also like to log it as info with the service calls log entry.My question is how should I be passing the data around?const t = service(a,b, correlationId)?Seems like a crosscutting concern polluting my API.Is there a different way? I’ve seen context saving packages, feels a little to magical, but maybe it’s magic or polluting the api?I’m doing Singleton instances for the services because there is some initial state that’s computed.

Submitted March 31, 2019 at 09:09PM by bfdill

I've an Idea ! Is that Possible with nodeJS ? Please tell me about your views !

I built an REST API for a Social Networking application it has too many end points. We're a start-up my boss told me to do a API documentation for all end points. I've now 114 End points with various inputs and combination of those results. *Is that possible to build an automated API documentation Builder for my future and my current Projects *?

Submitted March 31, 2019 at 08:39PM by MYTHiN07

Use multiple instances of nodejs or single instance for multiplayer game?

Hey guys,I'm developing a text multiplayer game that has 4 players at a time. Nodejs+Express is sending the "views" to the player.Is there an issue with having 3000 individual instances/processes of nodejs running, or is better to have one single instance of nodejs running which uses some sort of "session id" to differentiate between state?For example.mygame.com/session1 -- points to nodejs session 1mygame.com/session2 -- points to nodejs session 2These are two separate nodejs processes. I would prefer this if this isn't a major performance hit.Or I can write it this way.mygame.com/aefeafeaf1 -- points to main nodejs sessionmygame.com/geagea32 -- points to main nodejs sessionmain nodejs session grabs the session ID from the url then figures out what the user state is.Thanks for the help guys!

Submitted March 31, 2019 at 07:40PM by JohnJDonna

Chat app failing to match people randomly ? why websocket errror why

Hello precious people. I have a website on which I have a chat app. When I press start the bottom camera turns on, as it should, problem is in the web console of the browser I get this errorwebsocket.js:118 WebSocket connection to 'wss://websitename/socket.io/?EIO=3&transport=websocket&sid=Zw9loEcjt3V-WdHoAABH' failed: Error during WebSocket handshake: Unexpected response code: 400l.doOpen @ websocket.js:118plugins.js:60 From server: socket connected Zw9loEcjt3V-WdHoAABHThing is, I asked a friend to connect on the site from his computer , we both pressed start and it should have matched us randomly, but it deosn`t make the match, idk why ???

Submitted March 31, 2019 at 06:11PM by richardalpa

CHAT app failing to match people randomly

Hello precious people. I have a website on which I have a chat app. When I press start the bottom camera turns on, as it should, problem is in the web console of the browser I get this error​websocket.js:118 WebSocket connection to 'wss://websitename/socket.io/?EIO=3&transport=websocket&sid=Zw9loEcjt3V-WdHoAABH' failed: Error during WebSocket handshake: Unexpected response code: 400l.doOpen @ websocket.js:118plugins.js:60 From server: socket connected Zw9loEcjt3V-WdHoAABH​Thing is, I asked a friend to connect on the site from his computer , we both pressed start and it should have matched us randomly, but it deosn`t make the match, idk why ???

Submitted March 31, 2019 at 05:59PM by richardalpa

Authenticate a Node ES6 API with JSON Web Tokens

http://go.learn4startup.com/062238cfe0

Submitted March 31, 2019 at 05:19PM by GlennMulligan

Running Node and Mongo on a VPS -- Possible?

Is it possible to run Node and Mongo on a VPS?

Submitted March 31, 2019 at 12:21PM by TheAvogadroConstant

GraphQL for deputies open data in Brazil

A few months ago I created a GraphQL api with NodeJS to consume the Open Data of Deputies of Brazil, this GraphQL consumes a REST API.In Brazil we have a law that public information should be open to everyone else, but not everybody knows how to make a REST request and sometimes this information is not easy to access for all people, so creating this GraphQL I hope I can help other developer to create mobile/web apps to make people more informed about what the deputies are doing, voting and their expenses with the public money.Hope I can get some help and feedback from you guys.https://github.com/matheusrocha89/graphql-camara-deputados

Submitted March 31, 2019 at 10:10AM by matheusrocha89

Worked a little on worker-threads and benchmarking, here are the results -

https://github.com/nilshah98/worker-threads-NodeJS

Submitted March 31, 2019 at 10:16AM by Shambulock

Minimal Portfolio Built by developer for Developers

Hey Guys, Want an awesome landing page for your portfolio ? Have a look at this library , i built using REACT and Material UI, where you can simply just change some JSON properties and deploy on GitHub Pages for free and in just 5 minutes.Demo : https://singhkshitij.github.io/My-Landing-Page/ ( Click on the page to see Magic )You can find the code here : https://github.com/singhkshitij/My-Landing-Page

Submitted March 31, 2019 at 08:53AM by dev_singh_kshiti

Towards class-less JavaScript

https://coderbyheart.com/towards-class-less-javascript/

Submitted March 31, 2019 at 07:19AM by fagnerbrack

Saturday 30 March 2019

Need some help grabbing and outputting data from API

Hello. I just started coding Node.js and I am stuck on this problem I can't seem to figure out. I want to implement this API to grab the price of BTC when I type say !btc in discord. The API instructions says: But I can't figure out how to display the grabbed data from Step 3. I already installed the API program with npm install coingecko-api. Thanks in advance!//1. Import coingecko-api const CoinGecko = require('coingecko-api');//2. Initiate the CoinGecko API Client const CoinGeckoClient = new CoinGecko();//3. Make calls var func = async() => { let data = await CoinGeckoClient.ping(); };

Submitted March 31, 2019 at 06:31AM by rotaryfurball

Real-time Event System

Hello can anyone enlighten me how can I update the said event if it is already ongoing.eg. Name: Event1, From: 10:00 AM, To: 11:00 AMThe first solution i can think of is use setInterval for every 10 sec in the server to check every event.

Submitted March 31, 2019 at 04:32AM by janan666

Help with promise-pg (or node-pg)

Hi,I'm hoping someone can help me. I was getting error with that I am unable to insert since the query has multiple commands (1st command is to go to the schema 'set_path= "schema"; then INSERT ....)so far I am not sure how to properly do it, I tried many different commands and right now with the code below I am not getting errors (I get SUCCESSS) but it is not inserting in the db, any idea or help either with promise-pg or node-pg?! thank you in advance!! db.none('SET search_path = "schema"') .then(t => { 'SET search_path = "schema"; INSERT INTO table_name (attr1, attr2, attr3) VALUES ($1, $2, $3);', [attr1, attr2, attr3]; }) .then(t => { console.log('SUCCESSS '); }) .catch(error => { console.log('ERROR!!!!', error); }); EDIT: I should mention the the value I'm inserting are generated (fakes) so it's not fixed, I need this to fill the db with data

Submitted March 30, 2019 at 09:20PM by pompeii-eo

What does your Relational Database workflow look like during development and production

I'm looking to set up a backend API server in node + an ORM for a MySQL database. Coming from a Django ORM world, I want to know how to do the same in Node in regarding Models and Migrations and what your workflow is.​I've looked at Sequelize and TypeORM. Creating models/entities are pretty straight forward. I'm confused on the migration part. AFAIK, I'm not supposed to let the ORM library automatically "Sync" the models with the database automatically because of potential data loss. I must instead write migrations to do it.​So is it my responsibility to keep the migrations in sync with my Model classes? It seems like a lot of work and headache to take care of the intricacies such as data type and length, foreign keys, indices etc etc. In django, this was automatically done for you and you just look at it to verify. How do you do it?​How often do you find your self writing migration. Do you always have to keep a mental model of the migrations?​And finally, assuming you had 3 environments, "Production Server", "Testing Server" and your "Local Development Environment (your laptop)"What would your development workflow look like when working with node, mysql and an ORM of your choice?​​​

Submitted March 30, 2019 at 04:28PM by Krimson1911

Correct way to use onClick(); with Node apps?

I'm converting some pages over to pages in a node app and I have a lot of the app controlled by onClick(); function which execute properly in the standard HTML pages. When I bring them into my node.js app, the onClick(); functions not only do not work, but throw no errors. The functions are currently set to alert(); functions for trying to debug this issue. Can someone let me know if I'm doing this wrong? Should I be setting the onClick(); functions elsewhere other than in the HTML itself?

Submitted March 30, 2019 at 03:49PM by HauntingGeologist9

xLearno - FREE BETA ACCESS

Hi everyone, I’d like to present you xLearno; the only interactive, innovative & affordable platform to learn technology.My team and I have been working on this project for a lot of time and it’s finally coming together. We have launched a mailing list that will insure everyone who joins with a lifetime free access to all the courses and workshops. BETA will launch in 10 days and we’re planning on doing a full paid launch 90 days after.I’d like to personally thank each and every one of you who sign up for the BETA, no matter if you want to join and enjoy the courses or you’re wondering what xLearno is all about and you’re willing to provide some feedback.Here is the link - http://xlearno.com

Submitted March 30, 2019 at 02:36PM by HolidayInternet

how does auth0 redirect_uri work?

I understand that once a user is authenticated he is redirected to redirect_uri. What I don't get is, in the cast of SPAs, it's not as if the SPA has a built-in server (on the client-side) that listens to incoming requests? How can an external website (auth0) update the route of the client webapp with the new URL? Or does it have something to do with the browser history API? Clearly I'm missing a piece of the puzzle.

Submitted March 30, 2019 at 12:33PM by BuddhaBit

Building a fully customizable Carousel that supports multiple items and server-side rendering using Node

https://www.npmjs.com/package/react-multi-carousel https://w3js.com/index.php/2019/03/06/react-carousel-with-server-side-rendering-support-part-1z/Give it a try

Submitted March 30, 2019 at 10:57AM by yizhuang1996

Help needed

Given a public file URL, you need to copy the file and save it to firebase storage. You also need to make a public URL (storage_url) for the uploaded file (which the server uploaded to firebase storage) and save the name_of_file, original_url and storage_url to MongoDB Database.You need to make a “/get-file/:file_name” route which inputs a file name and returns the firebase storage URL.You need to make a “/get-usage-count/:file_name” route that given a file name will return the number of times the file details has been viewed from the route made in objective 2.can anyone help me with this assignment?

Submitted March 30, 2019 at 10:36AM by i_amabhishek

Update on Experimental Features in Node.js

https://nodesource.com/blog/experimental-features-in-node.js

Submitted March 30, 2019 at 08:47AM by r-wabbit

How Node Is Helping To Propel Angular

https://www.youtube.com/watch?v=Ki-bn7u3QFQ&t=1s

Submitted March 30, 2019 at 09:05AM by TairAdibek

ThanosAPI: API that returns Thanos quotes, built in Express. Would love feedback as this is my first Node Project

https://github.com/sggts04/thanosapi

Submitted March 30, 2019 at 09:37AM by sggts04

Node V8 - Building a JavaScript Runtime

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

Submitted March 30, 2019 at 08:01AM by RobertCotterman

Getting Started With Node.js and Apache Ignite

http://dev.thegeeknews.net/17ead73818

Submitted March 30, 2019 at 07:06AM by raikundalia

Friday 29 March 2019

MerkleTree.js - library to construct Merkle Trees and verify proofs

https://github.com/miguelmota/merkletreejs

Submitted March 30, 2019 at 03:11AM by mooogs

Best practices for frameworkless server, recommendations?

There doesn't seem to be anything out there in between building what barely qualifies as a server with 3 lines of JS and the suggestion to use Express or Koa, etc.Any good resources out there for building a server that at least fully complies with HTTP/1.1 and uses current best practices? Which features are necessary, security, etc. Preferably in node.js, but not necessarily.

Submitted March 29, 2019 at 11:54PM by noughtme

DeepCamera: Turn your android device into surveillance monitor which knows person with Nodejs

https://github.com/SharpAI/DeepCamera

Submitted March 29, 2019 at 10:22PM by solderzzc

Troubleshooting AWS Lambda 101 (x-post /r/aws)

https://www.reddit.com/r/aws/comments/b71sl8/troubleshooting_aws_lambda_101/

Submitted March 29, 2019 at 07:48PM by nshapira

Top 3 develompent trends in 2019?

https://blog.graphqleditor.com/Top-3-Development-trends-of-2019/

Submitted March 29, 2019 at 05:07PM by oczekkk

Records inserted using bulkwrite.. and db is running

I have inserted but still mongd running [conn17] . Not sure why. But i can see the record count like 20k . i also added a connection close after the end of last insert .. please help..

Submitted March 29, 2019 at 05:24PM by nako90

GraphQL Java Server

https://blog.graphqleditor.com/Getting-started-with-GraphQL-Java/

Submitted March 29, 2019 at 05:33PM by oczekkk

Any good tracking pixels out there?

I'm trying to learn Node by creating a simple project. I'd like to track website visitors and analyze click stream data. Anyone know of a tracking pixel project or solution I can use for this purpose? I guess the pixel itself isn't Node specific but since I'm going to be using Node, I thought I'd ask here. Thanks!

Submitted March 29, 2019 at 04:19PM by OlDirtyBrewer

Can I use child processes to improve a simple loop loop?

for (let i = 0; i <= 1000000000; i++) { if (i === 1000000000) { console.log("The number is: ", i); process.exit(); } } The number is arbitrary and just there as an example. Just imagine that the loop can take minutes to complete.

Submitted March 29, 2019 at 04:03PM by spider_milk

How to get a timestamp when user closes the browser and query to DB

I've created an app and want to keep track of when the user logs in and out. When the user logs in, a timestamp is sent to the db, same for when the user logs out, but how do I go about doing the same thing when the user closes the browser?

Submitted March 29, 2019 at 04:48PM by ortz3

.NET dev here - what's to like about Node?

I see a lot of interest in Node over the past years.I'm a backend developer - what's the huge interest in Node?​Things that I see are:- javascript works on frontend and backend- it's free- awesome communities

Submitted March 29, 2019 at 01:42PM by doormass

Backend develompent for newbies

https://dev.to/robmatyszewski/introduction-to-backend-development-for-your-mother-k8k

Submitted March 29, 2019 at 12:46PM by oczekkk

Android BYOD: staying connected without losing phone control

https://nckweb.com.ar/android-byod-staying-connected-without-losing-phone-control/

Submitted March 29, 2019 at 12:50PM by nickcis

Can I post a $50 task on here?

Hi guys,​Not having much luck with the quality on programmers on freelancing sites.I basically need a program that downloads Google Analytics data from the account that the user is connected to.​A screen will popup asking "Do you allow website xxxyyy.com to access your Google Analytics data, and then download some data from *their* account"​I'm pretty bad at oauth, can I post the task in here?

Submitted March 29, 2019 at 12:30PM by doormass

Use eslint with Typescript, today!

https://www.thedreaming.org/2019/03/27/eslint-with-typescript/

Submitted March 29, 2019 at 11:09AM by jwalton78

Let’s Dockerize a Nodejs Express API

https://itnext.io/lets-dockerize-a-nodejs-express-api-22700b4105e4?source=friends_link&sk=4d75295e4d352b8eabc4a7026432b269

Submitted March 29, 2019 at 11:16AM by EvoNext

How to handle concurrency

I have a challenge in my application being a node beginner.I want to write automated tests to a chat api.I have an array with questions which I loop through and post to the api.Responses from the api are not directly fetched unfortunately, there has to be a separate process which runs every 3 seconds checking whether there's a responses to the thread then notify my initial process to send the subsequent message in the queueI'm not sure how to set the initial loop to run only after we detect a response from the polling serviceAnyone care to assist me in this challenge?

Submitted March 29, 2019 at 10:08AM by marvoh

Whole npm private scope broken after unpublish of some package versions

In my company we are using npm private packages (aka private scopes) for internal stuff.We quite rely on it.​For the first time we had to unpublish some wrong package versions within our private scope @mycompany.Right after that, the WHOLE private scope @mycompany is broken and we are not able to install package withing our private scope @mycompany anymore!Our whole company is blocked!Even when trying to install private packages unrelated with unpublish, we get the following error message​​npm install @mycompany/utilnpm ERR! code E404npm ERR! 404 Not Found - GET https://registry.npmjs.org/@mycompany%2futil - Not found npm ERR! 404npm ERR! 404 '@mycompany/util@latest' is not in the npm registry.npm ERR! 404 Your package name is not valid, becausenpm ERR! 404 1. name can only contain URL-friendly charactersnpm ERR! 404 npm ERR! 404 Note that you can also install from anpm ERR! 404 tarball, folder, http url, or git url.​​Does anyone already has experienced something like that with private npm scope?​The npm support only open in 3 hours...​

Submitted March 29, 2019 at 10:16AM by yvele

What is the best cache DB with complex querying capability?

We are currently using REDIS for cache to store most used properties of mongo documents. The problem is we are not able to do complex querying and pagination which we can do with mongo. Is there any other cache dbs which support this?

Submitted March 29, 2019 at 07:11AM by rajks12

Thursday 28 March 2019

WebSocket + Node.js + Express — Step by step tutorial using Typescript

http://tech.edupioneer.net/7ef2e1de50

Submitted March 29, 2019 at 04:00AM by Feliciamyn

Beginner needs help!

Hello Webdevs,I'm new to web development (not programming). For the past few weeks I've been learning VueJs, Nuxt, Express and MongoDB. For a beginner project I want to create a simple Web App that fetches a players information from a video game. This video game doesn't have a public API, as far as I know, but their website does have an API with all of the players information. I'm having some trouble trying to figure out how one structures projects like this. I know that I'm gonna be using Vue as front-end, express as back and mongo for database. But how should I begin structuring this website. Should I build a rest API first? Do I complete my front end first? Do I complete my backend first? How would I go about fetching all of the information from the games website into my own api I can use?Basically I'm lost on where to begin. All of the tutorials and courses are a great tool to learn all of the frameworks. But I haven't found something that lays down a "roadmap" which tell you where to begin and wha to work on next.Thanks for everything!

Submitted March 29, 2019 at 04:05AM by itzalesh

How to build a CLI with Node.js [video tutorial]

https://youtu.be/s2h28p4s-Xs

Submitted March 29, 2019 at 01:58AM by brentschooley

Failed to save 12000 records in mongodb using mongoose from node js. Help !!

I’m trying to save 12000 rec to my mongo dB afte using model.save () . But cudnot see the collections in my dB. It good when I try to save 5-10 records .. please he,p me with this

Submitted March 29, 2019 at 02:10AM by nako90

Routing with Handlebars and Vhost: Router level defaults?

I'm trying to work out a way to configure Handlebars to use a different set of defaults for each individual router I use, but I'm coming a bit unstuck. I've found loads of ways to set those defaults on an application level (app.locals and app.set('views')), but not on a router level (i.e. something that doesn't persist between requests).​/app.jsvar express = require('express'); var app = express(); var vhost = require('vhost'); var exphbs = require('express-handlebars'); app.use(function(req,res,next) { app.engine('.hbs', exphbs({extname: '.hbs'})); app.set('view engine', '.hbs'); }) var websiteOne = require('./websiteOne/routes.js'); app.use(vhost('websiteone.com', websiteOne)); var websiteTwo = require('./websiteTwo/routes.js'); app.use(vhost('websitetwo.com', websiteTwo)); app.listen(8080); /websiteOne/routes.jsvar express = require('express'); var w1router = express.Router(); w1router.get('/', function(req,res) { res.render('index'); // This should use ./websiteOne/views/default }) ... Loads more routes here module.exports = w1router; /websiteTwo/routes.jsvar express = require('express'); var w2router = express.Router(); w2router.get('/', function(req,res) { res.render('index'); // This should use ./websiteTwo/views/default }) ... And loads more routes here too module.exports = w2router; Obviously I could use the full path inside the res.render for each, but given that I may have lots of different routes, I was hoping there'd be a way to set the view defaults once at the top of each routes.js file.​

Submitted March 28, 2019 at 11:04PM by floodlitworld

Node v11.13.0 (Current)

https://nodejs.org/en/blog/release/v11.13.0/

Submitted March 28, 2019 at 09:27PM by dwaxe

New to Node.js , where to start.

Greetings,I am attracted to Node.js because of prior experience with JavaScript and the fact that all I have to do is learn this 1 language thoroughly and I'll then be able to do so many things.With html/JavaScript/CSS I know I will create great websites, With Node.js I can take care of server code, and as far as Mobile App Development is concerned, I know I can now take code written in only html/Javascript/CSS and create Mobile Apps for android,iOS, and Windows phones.So, Great! One language and I now have access to everything pretty much. (aside from knowing basics of databases)But, Where do I start with this attempt at mastering these domains through JavaScripts?Personally, I need a recommendation for a solid hard copy book that I can use as a learning tool and for future reference. ( Do I need one for JavaScript and one for Node.js?)After that, any great video tutorial recommendations, that are not hard to follow, would be great.Finally, I would just like to hear your advice and insights about trying to master JavaScript and Node.js

Submitted March 28, 2019 at 10:34PM by QueryQueue

Express: How to handle multiple requests for the same data that takes a long time to execute?

In my express server there are some endpoints that takes a long time to process. I have to wait for the DB for a couple of seconds to finish execution. During this process if the user makes the same request then it does the same thing again. I can't use cache here. Is there any solution for this or am I doing something wrong?

Submitted March 28, 2019 at 08:00PM by aku_soku_zan

Trying to make async get request synchronous, what is wrong?

Cube.js, the Open Source Dashboard Framework: Ultimate Guide

https://statsbot.co/blog/cubejs-open-source-dashboard-framework-ultimate-guide/?865

Submitted March 28, 2019 at 04:25PM by Metalax

Running production-ready Node.js web apps in Ubuntu 18.04

https://medium.com/microsoftazure/node-js-web-apps-in-ubuntu-production-ready-58a78a6302d8

Submitted March 28, 2019 at 04:34PM by brunocborges

Why should I use a Reverse Proxy if Node.js is Production-Ready?

https://medium.com/intrinsic/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca

Submitted March 28, 2019 at 03:38PM by nucleocide

[HIRING][LONDON][Full-Stack Developer][Node & React][Luxury Fashion, Chat-Based E-Commerce][Permanent, On-Site][£70k - £100k] Link to Job Description on JavaScript Works

https://javascript.works-hub.com/jobs/senior-front-end-engineer-london-united-kingdom-99a87?utm_source=reddit&utm_medium=reddit%2Fnode.job.99a87.bse&utm_campaign=b.sheridan

Submitted March 28, 2019 at 12:58PM by BenSE-JS

Introducing experimental integrity policies to Node.js

https://snyk.io/blog/introducing-experimental-integrity-policies-to-node-js/

Submitted March 28, 2019 at 11:51AM by BrianVerm

How to get an array of versions of an NPM package

How do I programmatically get an array of versions of an NPM package? Is there an API I can use?

Submitted March 28, 2019 at 11:08AM by Richienb

How to set up cron jobs in Node.js applications

http://on.geeklearn.net/8fedf0162a

Submitted March 28, 2019 at 08:05AM by PalVaradiNagy

Wednesday 27 March 2019

How to install latest major version of package via NPM

Is there a shortcut I can take to install the latest version of a specific major version of a package via NPM?For example, if I want to install webpack 3, npm install webpack@3 would only install webpack 3.0.0.How would I make it install the latest major one? (in this case: webpack 3.12.0)

Submitted March 28, 2019 at 05:08AM by Richienb

convert dynamic IP addresses to staticIP.io

http://staticIP.io

Submitted March 28, 2019 at 03:23AM by irishgeoffrey

How to build a CLI tool in NodeJS

http://go.learn4startup.com/d51b4bcda0

Submitted March 28, 2019 at 02:28AM by ObsidianAge

How to send a private message to a particular socket ID ?

I have been trying to fiddle with this with no luck. With the code I provide below I am able to connect, retrieve the redis socket Id key and broadcast to all users, but I am unable to send a private message or rather, a message to a socket id; this is needed for private messaging as I really don't want to use rooms. The code block demonstrates the logic; I have hid a few things to just to target my question to free you from distractions after if (res ==1 ) is where the code is misbehaving in the private socket id message.​io.on('connection', function (socket) {console.log(' Connection established');socket.on('private', function (data) {let chat_object = JSON.parse(data.chat_object);let message = chat_object.text;let recipient = chat_object.to;let sender = chat_object.from;let date = chat_object.date;let read_flag = chat_object.read;let message_pending_for = recipient;let _active_users = new ActiveClient();_active_users.add_new_client(sender, socket.id);_active_users.does_client_exist(recipient).then(res => {if (res === 1) {_active_users.get_client_key(recipient).then(socket_id => {console.log('============================'+io.sockets.name)console.log('I am sending the message to: '+ recipient + 'and my socket id is'+ socket_id)io.sockets.to(socket_id).emit('incoming', "this is top secret")}).catch(error => {console.log("COULD NOT RETRIEVE KEY: " + error)})}}).catch(error => {console.log("Message Not Delivered To Recipient" + error)})})

Submitted March 28, 2019 at 01:14AM by Fuerzacode

Node.js Videos

Are there any videos out there (subscription based or not) that are similar to objc.io's Swift Talks? I started out with iOS engineering and have always found their content to be incredible. Their videos cover things like architecture, features, real life problem solving, new tooling, etc. Anything similar but for node.js out there?

Submitted March 27, 2019 at 08:15PM by ksatia

The shortest way to conditional insert properties into an object literal

https://dev.to/jfet97/the-shortest-way-to-conditional-insert-properties-into-an-object-literal-4ag7

Submitted March 27, 2019 at 09:20PM by jfet97

Use nvm without loading it

https://gist.github.com/chrisdothtml/95f79a1ecaa534839581583d22cce669

Submitted March 27, 2019 at 07:30PM by here-for-karma

Problem to save a form with select populate by database.

Hi, i have this on controller:const novaForm = async ({ Maquina }, req, res) => {const docs = await Maquina.find({status: 'livre'})res.render('operacoes/nova', { docs })}​this on view:​Controller to save:const novaProcess = async ({ Operacao }, req, res) => {const operacao = new Operacao(req.body)try{await operacao.save()res.redirect('/operacoes')} catch (e) {res.render('operacoes/nova', {errors: Object.keys(e.errors)})}}​And thats works correctly, the problem is when i try to save this on new table (operacao) on mongo, thats return this error:>> 47| <% docs.forEach( maq => { %>docs is not defined​Somebody have some clue? Ty..

Submitted March 27, 2019 at 06:08PM by azkrad

Simple blog part 1

https://youtu.be/LjfZymAZ4is

Submitted March 27, 2019 at 04:20PM by ngovanhuong94

Build a Cron-Job in Nodejs

https://blog.bitsrc.io/build-a-cron-job-in-nodejs-d117abd0be45

Submitted March 27, 2019 at 04:32PM by JSislife

FindOne error when creating new Model Mongoose

Hi there​I try to create a new User linked with a profile. Here is my models :​UserModel :​import mongoose from 'mongoose'; import {RoleModel} from "./RoleModel"; const bcrypt = require('bcrypt'); const UserSchema = new mongoose.Schema({ username: { type: String, required: true }, firstname: { type: String, required: true }, lastname: { type: String, required: true }, email: { type: String, required: true }, mobile: { type: String, required: () => { return !(!this.phone) } }, phone: { type: String, required: () => { return !(!this.mobile) } }, role: { type: mongoose.Schema.Types.ObjectId, ref: RoleModel, required: true }, password: { type: String, required: true } }, { validateBeforeSave: true, timestamps: true }); UserSchema.methods.validPassword = async (password, user) => { try { return await bcrypt.compare(password, user.password); } catch (err) { await Promise.reject(new Error('Error during authentication')); } }; export const UserModel = mongoose.model("users", UserSchema); ​RoleModel :​import mongoose from 'mongoose'; const RoleSchema = new mongoose.Schema({ name: { type: String, required: true } }, { validateBeforeSave: true, timestamps: true }); export const RoleModel = mongoose.model("role", RoleSchema); ​​With them I try to insert a new User and getting a role by name in creation. Unfortunately, I always get a `Segmentation fault (core dumped)` or Error during save. It seems my role is not found before saving action.​Here my methods :import {UserModel} from "./Model/UserModel"; import mongoose from "mongoose"; const bcrypt = require('bcrypt'); let user = new UserModel({ username: 'Fubar', firstname: 'Foo', lastname: 'Bar', email: 'foobar@fubar.com', mobile: 'my-awesome-mobile', role: RoleModel.findOne({name: 'DEFAULT_ROLE'}, (err, role) => { if (err) return handleError(err); return role; }), password: bcrypt.hash('myPlaintextPassword', 15, (err, hash) => { if (err) return handleError(err); return hash; }); }); user.save(err => { if (err) return handleError(err); }); ​Could you help me to reach to save efficiently my user please ? I guess I misunderstood something, but despite of my tests, I did not succeed to point it out..​Thanks,

Submitted March 27, 2019 at 01:26PM by CyrilZN

Fastify Twitter Example

I am unable to run the dockerized version of the fastify-twitter example.https://github.com/fastify/fastify-example-twitter​Logged an issue too https://github.com/fastify/fastify-example-twitter/issues/29 but no response yet

Submitted March 27, 2019 at 01:26PM by manisuec

CPU and I/O performance diagnostics in Node.js

https://medium.com/the-node-js-collection/cpu-and-i-o-performance-diagnostics-in-node-js-e513ba433c39

Submitted March 27, 2019 at 01:49PM by r-wabbit

NestJS or Express

I have experience using Express as a backend. I also use TypeScript in Express. However, my friend told me that NestJS is better in term of scalability. But it doesn’t really matter me because I try to organize the project structure as close as the clean architecture thing. So my question is, except from the project structure thing, does NestJS provide any advantages over Express with TypeScript?Notes: - As a personal preference, I also don’t like the concept of Angular. - I tried to use NestJS but it’s super confusing and strict. I really need to follow the documentation and I started to ask myself “If I want to use X module, which NestJS may support but no documentation, how can I use it?”; For example, PassportJS, there is a documentation for that but only JWT and Basic Auth. I want to implement Facebook Auth, and Twitter Auth but can’t seem to find any documentation about that.

Submitted March 27, 2019 at 02:08PM by FiveChjr

NodeJS API documentation and client generation

Hi Guys,Perhaps someone could give me some help or point me in the right direction. I'd like to implement proper documentation for my API and I'd like to be able to generate a typescript client for the front-end that uses fetch to make API calls.I found a solution for this using Swagger, and got everything set up and working. However, I've been sing the following library to generate my Swagger documentation and honestly, it's not very well maintained. https://github.com/olivierlsc/swagger-express-tsI've run into a couple of issues using this library and I don't think they'll be resolved any time soon.Do you guys know if there's any bigger libraries out there that I could use to generate API documentation based on inline code decorators? I'd rather not have a seperate documentation file that has to be maintained in tandem with developing new endpoints. I'm kind of surprised this isn't a bigger deal and I can hardly find any blogs about this issue. Perhaps I'm looking in the wrong direction though.Any help or advice would be appreciated!

Submitted March 27, 2019 at 11:01AM by circularDependency-

Why is NodeJS becoming so popular?

http://dev.thegeeknews.net/131c4fc7d7

Submitted March 27, 2019 at 07:31AM by MuhammadAdnano

Tuesday 26 March 2019

I almost goofed on my essay because of node

This is kinda off topic and I’ll probably lose 400 karma, but do you guys ever accidentally write JavaScript / node stuff on accident. I was writing an essay for English and I accidentally wrote some JavaScript in my essay. I also after I printed out a copy I realized that I put node server.js for my name. Is that just me, or do you guys do it too?

Submitted March 26, 2019 at 08:07PM by Creeperofhope

Under The Hood: Arrays in JS - First Class JS

https://firstclassjs.com/under-the-hood-arrays-in-js/

Submitted March 26, 2019 at 05:36PM by FirstClassJS

Twitter clone part 14

https://youtu.be/ttqqiWRZqQ8

Submitted March 26, 2019 at 05:48PM by ngovanhuong94

An Introduction to npm

http://thecodebarbarian.com/an-introduction-to-npm.html

Submitted March 26, 2019 at 04:02PM by code_barbarian

Using Testcontainers from a Node.js application

https://medium.com/graalvm/using-testcontainers-from-a-node-js-application-3aa2273bf3bb

Submitted March 26, 2019 at 03:31PM by PurpleLabradoodle

What if Node.js was able to enforce an integrity policy for third-party modules when they are required?

https://snyk.io/blog/introducing-experimental-integrity-policies-to-node-js

Submitted March 26, 2019 at 03:15PM by lirantal

What the Functor?

https://www.matthewgerstman.com/what-the-functor/

Submitted March 26, 2019 at 12:55PM by fagnerbrack

How should I structure my Git repo for keeping front & backend separate? Please help!

I'm planning on building an app which would involve GraphQL on backend and React on frontend. Now I want these two to be separate as I would be using CI/CD for deploying the app. The backend would be deployed to some server and the frontend would be hosted by github-pages.Since I'm a beginner and just learnt to use git and stuffs I'm not aware of the best practices. So I'm considering these options:Place frontend and backend in separate folders in the same repo.Place them in different branches in the same repo.Place them in different repos.I would like to hear your opinions. Thanks in advance.

Submitted March 26, 2019 at 02:00PM by shivamsingha

Request Id Tracing in Node.js Applications

https://medium.com/p/c517c7dab62d

Submitted March 26, 2019 at 12:49PM by jsloverr

What top companies you know that use Node.js?

Hey Reddit, I'm looking for popular companies that use Node.js as part of their tech stack, especially ones that switched to it from a different technology and documented it in the process. Do you know any? Would be incredible thankful for some suggestion.I have a list of 27, 16 of which I've described here. Couldn't find enough information for the rest of them.NetflixPayPalTrelloLinkedInYahooMozillaUberGrouponGoDaddyeBayWalmartMediumNASACapital OneCitibankMorgan StanleyMasterCardScotia BankHabiticaGhost (blogging engine)WordPress CalypsoQuizUpYandexImgurDuckDuckGoCourseraUnsplash

Submitted March 26, 2019 at 11:42AM by RST_IT

Do you use --abort-on-uncaught-exception?

Why would you use this flag when starting node? The help says it causes a core file to be generated. What can be done with this core file?In every application I run I have an uncaughtException handler where I log then do process.exit(), so does that mean this flag does nothing because there's never an uncaught exception since the handler always catches it?

Submitted March 26, 2019 at 11:46AM by nowboarding

🔩 Build Structured Web Socket Backends in Node with Hexnut

https://itnext.io/build-structured-web-socket-backends-in-node-with-hexnut-1d505c9c30b0

Submitted March 26, 2019 at 10:45AM by r-wabbit

What are the best packages to validate json?

I’m looking for something that balances power with a friendly api. What do you think of joi or packages that follow JSON Schema standard like ajv?What have you used before or are currently using and what do you like and dislike about them?What other options are worth considering?

Submitted March 26, 2019 at 07:37AM by nowboarding

How I built a Node.js Service to Clone my AWS S3 Buckets

http://go.geeklearn.net/5d47c28348

Submitted March 26, 2019 at 07:52AM by BillKarwinwin

Space Cloud is an open source, high performance web server which provides instant realtime APIs on the database of your choice. It eliminates the need to write any backend code (nodejs, php, java) for CRUD applications. It does much more. Would love to get your thoughts on it

https://github.com/spaceuptech/space-cloud

Submitted March 26, 2019 at 08:33AM by Vech100

KnexJS and Postgresql

I'm a self taught noob, that is a about to begin interning as a developer. I've been told to run an app locally and debug the code. The app uses KnexJs and Postgres.I have cloned the app locally and installed all the dependencies required but when I run it get an error:"Error: knex: Required configuration option 'client' is missing."Couple things I'm not sure about: - If I need a Postgres admin locally - How I configure my local clone to talk to the database - How Knex talks to the database - How to configure KnexI have no prior experience in KnexJs or Postgres, so I am open to suggestions and directions to understand these technologies.

Submitted March 26, 2019 at 09:47AM by nmutuaaym

Monday 25 March 2019

Golang for Node.js Developers

https://github.com/miguelmota/golang-for-nodejs-developers

Submitted March 25, 2019 at 11:50PM by mooogs

What datatype to use for lat long in Sequelize?

I have this data from openweather for list of cities. This is one of the object:{ "id": 5128638, "name": "New York", "country": "US", "coord": { "lon": -75.499901, "lat": 43.000351 } }I want to store these list of cities to database. I have not decided yet which one would I go for - Postgre or MySQL.The use case here is I want to find all the lat long within 10 miles radius from a given lat long.I was hoping I could use something like this to do the job. But, if there's any tool that could do it I'm also open to that.

Submitted March 25, 2019 at 11:31PM by phoenixlads

Mongoose Tutorials: Faster Mongoose Queries With Lean

https://mongoosejs.com/docs/tutorials/lean.html

Submitted March 25, 2019 at 10:22PM by code_barbarian

Some node.js scalability issues and how to solve them

Hi lovely node.js strangers.​In this article, I'm talking about some of my adventures scaling node.js servers.https://softwareontheroad.com/nodejs-scalability-issues​What was the most annoying thing you had to do in order to scale your application?​Mine was moving the auth layer from node.js to AWS Cognito.Why I did that?I wish I have an answer, sometime scalability and success is about proper management and office politics.That's why I didn't mention it in the article.

Submitted March 25, 2019 at 10:42PM by santypk4

Recommendations on node + mongodb + image hosting

As the title says, I built a node application for a business that uses Node, mongoDB, and multer to add / delete photos locally.I was wondering where I should host it, after some research I was thinking Node Chef (https://www.nodechef.com/nodejs-hosting) - as they have all three, but I don't have any experience, so I don't know how much I should be paying, or how much I need for a low traffic business.Any help would be appreciated.

Submitted March 25, 2019 at 09:44PM by FreakshowTJ

a beginner in nodejs

Hi, I'm currently learning back end using node.js and express. I'm here to ask you for your advice/tips on how to learn node.js as a beginner. Currently, I'm watching a course by Tony Alicea 'Learn and understand nodejs'. And I've noticed that programming in back end using these technologies is mostly learning the documentation of certain middleware and using them. As a beginner, I feel kinda overwhelmed by the amount of modules that I need to know. I lack the confidence to actually build something because I feel like I don't know a certain module well enough and etc. Did you have this problem when starting out? What should I do? One more question, was getting into back end by learning nodejs a mistake(as someone who lacks experience in back end)? In the past, I've learned some front end, basics of javascript and mostly DOM manipulation. Thanks in advance.

Submitted March 25, 2019 at 09:04PM by R2UR

What are the use cases for "child_process" ?

API doc mentions the following: "It is important to keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel that is established between the two. Each process has its own memory, with their own V8 instances. Because of the additional resource allocations required, spawning a large number of child Node.js processes is not recommended."If I use child processes, then based on the number of requests, multiple child processes will be spawned. So what is the exact use case for the child_process module? When have you actually implemented it at your company or in your application?

Submitted March 25, 2019 at 07:54PM by shri29

automating-scraping 101 (where to start)

So, I've seen lots of references to Puppeteer to do this job, but, why puppeteer in first place? (n00b here).There are other tools such as webdriver, cypress, others... I would like to play with the 'right' tool /most used and user friendly :) any advice?Thank you :)

Submitted March 25, 2019 at 06:07PM by include007

Do I still need node_modules folder after running npm build?

I've run a production build of a server-side rendered React app. So entire project includes some server-side code in Express and other client-side code in React.​Since I've run npm build to build everything together, do I usually still need the node_modules folder? That's, during deployment, do I still need to run npm install to pull all the dependencies?​At the moment, it seems like I would still need to run npm install to get the node_modules because node complains that it cannot find module 'express' until I did an npm install.​This is my first attempt at SSR and so I'm not sure about whether I would still need the node_modules folder. In most cases when I build everything through create-react-app, I never need the node_modules folder after building it.

Submitted March 25, 2019 at 06:38PM by decorumic

Javascript, Drools and GraalVM

http://blog.athico.com/2019/03/droolsjs-towards-polyglot-drools-on.html

Submitted March 25, 2019 at 05:35PM by adila01

express-validator-openapi: Automatically validate API requests against an OpenAPI 3 specification with Node.js

https://github.com/cdimascio/express-openapi-validator

Submitted March 25, 2019 at 04:08PM by coracarm

An Interactive Programming Language

https://mcsh.github.io/programming/2019/03/25/an_interactive_program/

Submitted March 25, 2019 at 02:07PM by MCSajjadH

Worker Topology: A very easy and declarative way to create sophisticated Node.js Worker Threads topology

https://www.npmjs.com/package/workertopology

Submitted March 25, 2019 at 01:51PM by ayhanalkan

noob question re request, qs and passing params

hi guys​I"m new to node and using nodejs request & qs to query a rest API call to retrieve products. For exampledomain/products/?searchCriteria[filter_groups][0][filters][0][field]=sku&searchCriteria[filter_groups][0][filters][0][value]=24-MB06 ​I'm trying to build this call as a promise call & also use "qs" to handle the param part.I can convert the above to something like this params = {searchCriteria: { "filterGroups":[{"filters":[{"field":"sku","value":'24-MB06'}]}]}} and pass it to qs like thisconst qs = require('qs'); const request = require('request'); return new Promise((resolve, reject) => { request({ uri: uri, method: method, headers: headers, rejectUnauthorized: false, qs: params, body: JSON.stringify(data) }, (err, response, body) => {.... ... }​However, I can't really figureout if say I need to add another param to the params string &fields=items[sku,name]while still maintain the above promise & qs approach (like the above)(A test postman call like the one below works just fine)domain/products/?searchCriteria[filter_groups][0][filters][0][field]=sku&searchCriteria[filter_groups][0][filters][0][value]=24-MB06&fields=items[sku,name] I'm hoping to get some tips from the communityThank you​​

Submitted March 25, 2019 at 11:43AM by duyth

Practical guide on how to write portable/cross-platform Node.js code

https://github.com/ehmicky/portable-node-guide

Submitted March 25, 2019 at 11:07AM by r-wabbit

Introducing a free starter web app combo: api + frontend. JavaScript, VueJS and MongoDB. Also looking forward to work with a great team.

API: https://github.com/davellanedam/node-express-mongodb-jwt-rest-api-skeleton/blob/master/README.mdFrontend: https://github.com/davellanedam/vue-skeleton-mvp/blob/master/README.md

Submitted March 25, 2019 at 07:56AM by davellanedam

Node Express Analytics Dashboard with Cube.js

http://dev.thegeeknews.net/2b96f92501

Submitted March 25, 2019 at 08:46AM by MarkOliver908

Is it bad practice to build the frontend and a backend API in the same app?

I'm learning node and I have an idea for a simple hobby project. I want to make a simple text-based RPG. NPCs, locations and player data will be stored in MongoDB and accessed through a REST API for simple CRUD.It kind of seems like overkill to separate the game into two apps (a backend API and a frontend interface). But that seems to be how most projects seem to be designed. What am I missing? What are the downsides for creating a single app that handles both?

Submitted March 25, 2019 at 10:23AM by DJ_Beardsquirt

JSCasts ep10 - adding admin panel to Node.js app in less than 10 minutes

https://youtu.be/7Ujn7g1JF1Q

Submitted March 25, 2019 at 09:45AM by lysywojtek

Is basic knowledge of JS enough to start learning node?

Hi, is basic knowledge of JS enough to start learning node or its mandatory to first make some projects and solve challenges in JS? Since Node is nothing but a run time environment which is coded in JS, am assuming there won't be much problem.What are your views?PS: While I respect everyone's view this question is strictly for node developers because I believe someone who is in same tech stack would be better to guide. Please restrict yourself if you aren't one. Thanks for understanding.

Submitted March 25, 2019 at 06:17AM by geeky_ninja

How to Build A Movie Bot Using Node.js?

http://on.geeklearn.net/fc3918dbe3

Submitted March 25, 2019 at 06:53AM by Newsomome

CWS - fork of old uWebSocket 0.14 with complete rewrite js to typescript and minor changes in C++.

https://github.com/ClusterWS/cWS

Submitted March 25, 2019 at 07:05AM by goriunovd

Any recommendations for an IDE for small node projects? [x-post from r/javascript]

https://www.reddit.com/r/javascript/comments/b57bza/any_recommendations_for_an_ide_for_small_node/

Submitted March 25, 2019 at 07:09AM by the_vico

Sunday 24 March 2019

How to use Node.js, Express.js and Multer Restful API for Image Uploader?

http://on.geeklearn.net/442bcd4016

Submitted March 25, 2019 at 04:02AM by Levine9012

JavaScript "loose" comparison step by step

https://felix-kling.de/js-loose-comparison/

Submitted March 25, 2019 at 01:35AM by fagnerbrack

Anyone extremely familiar with the swipe api?

This is a timely manner. I specifically need someone that has a lot of experience with the swipe api. I will pay you for setting it up on my site. I am setting up with a new host. I can send you the html/css/js/php files and I need you to add the payment method and make a few minor adjustments involving markup. It is almost name your price. Please advise. DO NOT WASTE MY TIME UNLESS YOU HAVE A DEEP GRASP ON SWIPE APIEdit: https://www.robkososki.com/ I already have an account with swipe. I need someone to do literally everything to set up payment processing on that site.This is not spam, I know my user name is ridiculous. If you can come up with a way for me to show you I am legitimate, I will do it. I have access to my site cpanel, my twitter, instagram, linkedin, whatever you need. This is extremely timely.

Submitted March 25, 2019 at 12:40AM by PM_ME_YOUR_HOG_PLZ

BSD3-Clause on NPM modules

Unable to create new entry in production mode using Strapi

Please help! Struggling with this issue for 2 days, need help - https://stackoverflow.com/questions/55329573/unable-to-create-new-entry-in-production-mode-using-strapi

Submitted March 24, 2019 at 11:45PM by IAmNotARedditUser

[Question] How do I structure my application?

Hey everyone, working on my first "real" web application (my own idea, not following a tutorial) and I am having trouble figuring out how to structure/encapsulate my business logic, specifically for the user's initial login.The high-level steps I need to take are as follows:fetch data from an external serviceformat and save said data in my own Postrgres databaseretrieve saved data from Postgres, format as ndjson and save in an Elasticsearch indexfetch documents for a given query from ElasticsearchSteps 1-3 would be done via my Node/Express server and step 4 client-side (a React app). The main problem I'm facing is not knowing how to write this code in a succinct manner. I know how to accomplish each step programmatically, however, I don't know if all of this logic should be done in a single controller or broken up in many functions. How would something like this be done in the real world?Been stuck on this for a week now and would really like to get this ironed out. Of course, the above steps might not be the best way to go about the initial user login process so any advice on how to better design that would also be appreciated. Thanks in advance!

Submitted March 24, 2019 at 11:52PM by Cedricium

How to nake 2 or multiple services communicate with each other?

Hey all! Like the title implies I'm wondering how to make 2 or multiple services communicate with each other. Because now I use websockets. But I'm really unsure if that is the way to go, because it feel wrong for some reason.Are there any other pieces of software I can use to make them communicate with each other beside websockets or HTTP.

Submitted March 24, 2019 at 11:16PM by Swaxr

Advanced Node.js Tutorial

Welcome to the advance Node.js course.https://www.youtube.com/playlist?list=PL4IgyW_AvXtRrWE6AdSxRcF9qqfA5oJmP

Submitted March 24, 2019 at 09:40PM by AbirSaiful

How To Set Up a Node.js Application for Production on Ubuntu 16.04

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Submitted March 24, 2019 at 09:42PM by bch8

For what is the node used in companies?

I want to know what the node is being used in companies (API's, microservices, chats?)

Submitted March 24, 2019 at 04:39PM by rootuser_

Making a Multiplayer Game With Unity3D and Nodejs

Securing Node.js Applications with Intrinsic

http://go.learn4startup.com/ca6024abbb

Submitted March 24, 2019 at 03:30PM by NicholasTower

Created my first npm package: a simple file sharing cli app for local networks https://github.com/mihai-dinu/node-sherry

The idea came to me when I wanted to share some larger files with some of my work colleagues, but didn't have a good and fast way of doing it. So, I made my own cli app for doing this. It's only supposed to work on LANs.It's not finished by any means, but it's in a pretty good state at the moment, with the major functionality working.I'm curious what feedback I can get from you guys on the project. Oh, and it's written in typescript because I wanted to try something new.GH link: https://github.com/mihai-dinu/node-sherryNPM link: https://www.npmjs.com/package/node-sherry​Demo usage:https://i.redd.it/xa0jksh212o21.gif

Submitted March 24, 2019 at 11:47AM by pantydroppin

(Express) Error logging best practices/tips

I would like to know some best practices, tips or your experiences for error logging an API during. I plan on using PM2 and i know they have some type of logging built in for console.logs, but I'm not sure that is the way to go. Also I've looked into Sentry which seems absolutely amazing, but it's a bit pricy for me right now. Currently I run a setup similar to this.// index.js const bunyan = require('bunyan'); const express = require('express'); // Express App const app = express(); // Create the logger const logger = bunyan.createLogger({ name: 'API', serializers: { err: bunyan.stdSerializers.err, req: bunyan.stdSerializers.req, }, streams: [ { type: 'rotating-file', path: appRoot.resolve('./logs/api.log'), period: '1d', count: 14 } ] }); // Require app routes require('./routes')(app, logger); // Error middleware app.use((req, res, next) => { logger.error(res.locals.err); }) ​//routes.js module.exports = (app, logger) => { app.get('/some-function', (res, req, next) => { try { doSomething(); } catch (err) { if(err instanceof KnownError ) { logger.warn(err); } else { res.locals.err = err; next(); } } }) } I would love to get your opinions and recommendations on this

Submitted March 24, 2019 at 11:52AM by runo9

Announcing a New Management Structure for Ecma TC39

https://hacks.mozilla.org/2019/02/announcing-a-new-management-structure-for-ecma-tc39/

Submitted March 24, 2019 at 07:37AM by fagnerbrack

Node.js project for learning

Hello as i'm learning Node.js i want to create app that 1. Will have configuration menu with username, login and car number 2. Will have Pay button.This app should connect to specific webpage with login and password. In that website there is search menu so it should search for car number and after car found should click pay button.This app could be android app, desktop app or Chrome plugin.This project i created for myself that i could lear Node.js so for most part i want to use node but i know thay i still need aditional tools like Elektron if i want to create desktop app.So maybe some one can help me with this apps archeticture, like what tools i would need besides node.js and how to structure it(where i can read how to cennect to sites and do some actions on it, or examples of similar projects) Without proper archeticture i dont even know where to start so i'm strugling from get-go. Thank you.

Submitted March 24, 2019 at 09:24AM by Grfokpr

is there any telegram group for node js developers?

No text found

Submitted March 24, 2019 at 09:36AM by daniad7

Saturday 23 March 2019

Twitter Typeahead issue

I am currently doing a project which requires implementing typeahead.js. The problem that I am facing is that I am successfully sending a get request when any thing is entered in the input field but cannot get any result from the serverThe input field that i am using to show the result.​Typeahead js code which I have copied form their examples​Route in which the request is completed and the result is obtained​Log which is printing the correct values when initially I am writing 'p' then 'pa' in the input field​This is the output that i am getting displayedI cannot understand what I am doing wrong. Event logging 'data' on the client side is showing data not declared.Can anyone tell me how to properly implement this code and how to implement Twitter Typeahead. Thanks

Submitted March 24, 2019 at 05:22AM by Dara_Singh

Running CPU Intensive task with Nodejs

https://medium.com/@badewakayode/running-cpu-intensive-task-in-nodejs-db4f995db310

Submitted March 23, 2019 at 11:45PM by kayslayr

Why I wrote a shitty npm package and why few people still useit

https://codeoldschool.blogspot.com/2019/03/why-i-wrote-shitty-npm-package-and-why.html

Submitted March 23, 2019 at 07:49PM by kawadhiya21

Need Tips: Advanced Scraping Methods

Hi,I'm looking for some articles, videos or other resources on more advanced scraping methods. My question really is, how do apps like Pocket always grab the body of an article or headline without knowing the selectors on the page? I imagine that they have some kind of algorithm that determines if a div has certain content in it while traversing the DOM. I'm just wondering what those algorithms might look like. Or maybe they grab site mapping or RSS from somewhere? Any advice helps.Thanks!

Submitted March 23, 2019 at 05:48PM by maximusprime2328

npm install missing

so i wanted to export my GDevelop game through Cordova and then it saidError: Cannot find module '/home/user/install'can someone help?

Submitted March 23, 2019 at 02:18PM by Snowolfdotcom

Communicating Sequential Processes re-evaluated!

https://github.com/jfet97/csp

Submitted March 23, 2019 at 06:01AM by jfet97

Friday 22 March 2019

Feedback on a non-ORM data access approach

I've been using an ORM for years - and often still find myself frustrated trying to map the complexity and nuance of SQL to an ORM api.What is attractive to me about ORMs, though, is the marshaling of raw result rows into predefined structured objects (preferable pure objects).With the desire to write raw SQL, and receive back pure, properly nested business objects, I built a small library layered on top of a database driver to do this.I'd love to hear feedback on this approach! I was surprised to not find anything in this space, and wonder if there are more people in between the "just use database drivers" and "just use ORMs" camps.The library is https://github.com/craigmichaelmartin/sql-toolkit

Submitted March 23, 2019 at 02:28AM by sammrtn

So I've been using this config library I wrote for a while now and would love some feedback.

https://github.com/from-nibly/configAt the time I wrote it I couldn't really find another library that did what I wanted it to do. I was heavily influenced by spring properties. Although I don't agree with spring on a lot of things I would say that their approach to properties is dead on. This library essentially creates one giant flattened property structure which you can then inflate into objects if you like. The number of property sources is pretty sparse at the moment mainly just Environment Variables and File based, but you can just write a property loader to extend it. (edit: I have done this a couple of times already where I needed a really specific property loader for a single project)​Hopefully I'm not completely blind and there is already something out there that does this. Or maybe hopefully there is and I wont have to maintain this one? Anyway have at it.

Submitted March 23, 2019 at 02:41AM by from-nibly

Which Query Builder/ORM should you use for Nodejs

http://go.geeklearn.net/5296afacea

Submitted March 23, 2019 at 02:47AM by CarlJohnson8x

AWS + Epsagon: Serverless Observability Webinar (x-post /r/aws)

https://www.reddit.com/r/aws/comments/b4clh8/aws_epsagon_serverless_observability_webinar/

Submitted March 23, 2019 at 12:19AM by nshapira

Courses with javascript and node.js

Hi, anyone can recommend good online courses with javascript and node.js? Im not rich so I hope they'll be cheap or if someone is able to give me login and pwd, i'll be thankful.

Submitted March 22, 2019 at 08:30PM by kodxinvcc

TFW You get a long, clean promise chain going.

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

Submitted March 22, 2019 at 06:45PM by slonermike

Digging through Express.js source code

Would any experienced engineer out there be willing to dig through the Express.js source code with me to understand it more? I don't like using systems unless I understand what's happening under the hood and, while I have mostly used pure Node.js, I want to understand Express.I'm also not great at understanding source code and figure I can hone that skill by doing this.​I've found plenty of guides out there that try and walk through it but really gloss over a lot of it - they've given me a cursory glance and how things work but I need to go further.

Submitted March 22, 2019 at 06:04PM by ksatia

How to unzip 200 files into 200 folders?

I have a folder that has about 200 file in .zip format. I used to do it manually where I unzip each file to a separate folder named after the file. I want to automate this process now since the number is growing. how would you do that? which library do you recommend? Thanks!

Submitted March 22, 2019 at 06:06PM by Demado

This Week on npm v20190322: core-js@3.0.0, uglify-js@3.5.0

https://js.report/blog/this-week-on-npm-20190322

Submitted March 22, 2019 at 05:22PM by code_barbarian

Using Puppeteer to generate HTML to PDF

Hi​I am new to using Puppeteer and was wondering if we can pass CSS along with HTML string to Puppeteer to generate the PDF?

Submitted March 22, 2019 at 03:25PM by codeblue_

Free daily coding challenges in JS

https://www.algodaily.com/

Submitted March 22, 2019 at 12:52PM by scienceram

New nodejs framework has been released

nodejs lovers, this is a big announcement After one year of working hard, I released a framework based on node.js which enables you to build web apps easily without confusing, frustrating and without needing to a lot of packagesThis framework called Grandjs our passion is competing for expressjs loopback, hapi, and many great frameworks and I believe that Grandjs equals all these frameworks and will compete them.Grandjs features: 1- solid and controlled Routing system which allows you to control and handle every small part in your urls system 2- functionalities to encrypt and secure data and cipher them without needing to any extra modules 3- validation system enables you to validate coming data and check them, and remove strip tags 4- Grandjs uses handlebars as a template engine 5- session module inside the framework enables you to make sessions and set cookies and all that stuff 6- flash messages you can send them to handlebars 7- compatible with single page appsGrandjs is live now on github https://github.com/tareksalem/grandjsAlso, it is love now on npm https://npmjs.com/package/grandjs

Submitted March 22, 2019 at 11:30AM by tareksalem1

How to build a CLI with Node.js

https://www.twilio.com/blog/how-to-build-a-cli-with-node-js

Submitted March 22, 2019 at 09:40AM by js_dom

Understanding Streams in Node.js

http://tech.learn4startup.com/2976877740

Submitted March 22, 2019 at 07:27AM by Ratlifford

Containerizing a Node.js Application for Development With Docker Compose

http://go.learn4startup.com/46a53b78ff

Submitted March 22, 2019 at 06:53AM by CharlesPolley

Thursday 21 March 2019

Where to post your Node.js projects for demos?

I sometimes build SPA applications that require a server piece (written in Node mostly; but I guess there are other things that could go in there). Github Pages only does static.Where do you guys host your low-computational effort apps? Tempted to grab a small $50 DO droplet or something and use that but it might get crowded. Not sure. :) Heroku is another option but it can't do everything.​What do you guys do?

Submitted March 22, 2019 at 04:07AM by vaughands

How to get a software engineering internship in 2019

So you want a coveted internship? This answer is mainly geared towards software, but can be applicable to any industry.I have some tips that helped me get my first software engineering internship in Silicon Valley, right out of my coding bootcamp. I break down some of the best ways to get an internship as quickly as possible, as easily as possible.Whether you studied computer science in college, went to a coding bootcamp, or are self-taught, these tips will help you through.If you prefer video format, here’s a video I made covering these topics:https://youtu.be/eyzKYYwB0ngThe first main tip is to start as early as possible. Bigger companies who have the most internships available start early in August, September, an October with posting their internships. The earlier you start, the higher chance you have at beating the competition.The second tip, and probably the most crucial one is to use your network. Using the back door to get your foot in is much easier than using the door that thousands of people are using (the automated online job portal). You can use LinkedIn, Facebook, and word of mouth to find people who worked at specific companies. On LinkedIn, you can use search queries like [Insert college here], and then use people filters such as 1st /2nd-degree connection, location, and company. This helps hyper-target your audience.The best people in your network to reach out to are:- College / coding bootcamp alumni who work at the company you want to work at- Friends / classmates who interned at that company- Professors / mentors who might have connections with that company- Friends of friends who work there (use Facebook to search this - “friends of friends who worked at [X company]The next tip (this is crucial, and will save you a ton of time). Don’t send your resume off into a black hole (such as Indeed, Glassdoor, etc) and do nothing else. My rule is for every job app you send into an online portal, you need to connect with one real person as well. There are a handful of ways to connect with a real person at this company - use a Gmail plugin like Clearbit Connect, or Hunter io to find peoples’ work emails by company search (give them a quick Google - you’ll see what I mean). These are extremely powerful tools. Then, send them a quick note:~~~Hi [person’s name]!My name is [your name], and I’m an [type of engineer] in [location].I’m reaching out because I applied to [company] regarding your [position].I have experience with [this technology, skill, etc]Following up, I've provided my resume and cover attached letter below.Would someone on your team be open to chatting more about this role by [insert date to add time pressure]?Thanks so much![Your name][Phone number]~~~Following up after they’ve responded:Would you be willing to connect me to the hiring manager for this position per chance? I'd greatly appreciate it!Thanks so much![Your name]~~~The most important thing is to not be annoying. If they don’t respond after following up once or twice, try another person at the company.If you’ve used the last 2 tips (network, reaching out) and have finally connected with a real person, you can ask them “How can I stand out in the intern application process for [X] company?”, or even better, ask to buy them a coffee and pick their brain about their experience working at the company, the company culture, and to see if you’d be a good fit.Another way to stand out is to have an amazing portfolio. This isn’t absolutely necessary (at least for Software Engineers), but will help you stand out above the crowd. My tips here:- Host your projects on Github (clean up code, add ReadMe, etc)- Add your projects, with screenshots and descriptions, to your LinkedIn experience/projects section- Create a video outlining your design decisions, tech choices, etc (I did this when applying, and it definitely helped)- Deploy your projects to the web, and have a landing page which can direct people towards themThe next tip is to prepare for the technical interview. If you’ve gotten this far but fail the technical portion, chances are you won’t make it further. They can give you any question, but your goal is to be familiar enough with basic concepts, so you can adapt on the spot. Using sites like LeetCode can help improve your technical ability. It also helps if you’ve seen similar questions to the interview ones - LeetCode will help you with this. Sites like Pramp help you practice interview skills live, which is another surefire way to get feedback and improve your chances at doing well. Take a few deep breaths before you walk into the interview, and you’re ready to go because you know you prepared!The final tip I have (and one that sped up my job search tenfold) is to track EVERYTHING. There’s a Gmail plugin called streak that allows you to track your job search in a funnel. Streak also allows to send template snippet emails, and you can see if someone has viewed your email. So handy!I customized the funnel by tracking:Company NamePosition NameContact NameContact EmailContact LinkedInDate of Last ContactJob SourceJob Posting URLIf you’re not a fan of Gmail plugins, you can also use a spreadsheet like Excel, Google Sheets, and my favorite (spreadsheet/database mix) Airtable! Airtable is a solid option, because it allows you to link different tables, attach documents, and organize things with ease. An Airtable tutorial would take a whole other post, but I encourage you to check it out!The job search is ultimately a game of failure, persistence, and triumph. You ultimately need to create your own luck, and this happens by widening your pool. Start applying to as many places as possible! These tips I shared above allowed me to apply to 150 jobs in 3 days! Most of the time I ignored the cover letter (do they really matter, anyway?) and focused completely on connecting with a real person. That’s what will ultimately start you on your journey.

Submitted March 22, 2019 at 04:24AM by mattupham

Any tips from experienced node devs appreciated

I have been expanding my JavaScript skills over the past 6 months and in my new job I took on multiple small to medium sized applications to fix workflow problems throughout our company using node Express and react. I have been extremely happy with my work but before this I was a front end developer focusing primarily on websites but in my new role I wear quite a few hats between front and back end and design.So my question is, is there any obscure gotchas that node developers tend to miss in the early stages? Everything has been running good and I try to refactor when I get time but sometimes I worry there's an awesome toolkit or technique I could be missing out on.Thanks for any tips!

Submitted March 22, 2019 at 02:19AM by tmac9494

Searching for Best Online Tutorial to learn Expressjs+MongoDB user authentication

I have searched extensively for an extended tutorial, showing how to develop a middleware in expressjs and how to handle the frontend part in authenticating a user. However , I couldn't get any tutorial explaining the same in a more detailed manner. Specifically I'm searching, for the following gaps on the subject matter.In case the user is authenticated for the first time, the server sends a JWT JSON Web Token to the browser.Now, do I need to put this on the request header every time I call a route in the server ?What do I need to do in the front end in order to make the user authentication system to work?I have followed the facility given by the passport.js (local strategy). However, there is no explanations that tells what does the method call back do and how do they work internally.In case I'm authenticating a user using cookies, how to persistently store the JWT across the browser tabs securely.I followed a tutorial that has only shown the code for JWT user authentication without using passport.js. I have been trying to understand how the JWT user authentication works. However, I'm getting No authorisation error, even after a new user signs up and the server sends a JWT to the browser.​UnauthorizedError: No authorization token was found You can find the code here (https://glitch.com/edit/#!/quiver-stoat)Please comment and see if you can helpThanks.

Submitted March 22, 2019 at 02:21AM by iaminbadland

Can someone here help me out a bit? Having issues with either Node, promises, or sequelize. In over my head...

Hey there r/node, thank you for providing this community. I didn't even know about it until a few months ago, and I've tried to be helpful, but ... someone usually beats me to it! :)​This time, I need a hand. I'm running a Node app on an Ubuntu machine, it connects to a remote MySQL database, hosted on a digital ocean droplet. The droplet isn't the tiniest size, and I've done bigger things than this with MySQL over the years, without these sorts of issues. I'm having a hard time with this, I'm overdue, my mom's going to ground me if I don't get this finished, and then I won't get my $10 for the book fair next week. :(​In a nutshell, I use the filesystem to pipe data from a csv file into an array, so I have an array, with each element being a [Firetruck Name, Firetruck Location, Firetruck Owner, Firetruck Age]. All I'm interested is, in one little piece, the "Firetruck Name,"...​So, I created a csvdata.forEach loop, and inside of that I used a Sequelize model of my firetruck to store it in the remote database. The table has two columns: ID, FireTruck_Name. All of the mapping works correctly, I can call models.Firetruck.findOrCreate({where: {FireTruck_Name: fireTruckName}}) - just once, for example, and all works well.​But when I'm looping through my csvdata using forEach, I run into errors like this...​name: 'SequelizeConnectionAcquireTimeoutError',parent:TimeoutError: Operation timeoutat Timeout._timeout.setTimeout (/media/noel/FILE_LOCKER/DEV/PCP2/node_modules/sequelize-pool/lib/Deferred.js:19:19)at ontimeout (timers.js:436:11)at tryOnTimeout (timers.js:300:5)at listOnTimeout (timers.js:263:5)at Timer.processTimers (timers.js:223:10),original:TimeoutError: Operation timeoutat Timeout._timeout.setTimeout (/media/noel/FILE_LOCKER/DEV/PCP2/node_modules/sequelize-pool/lib/Deferred.js:19:19)at ontimeout (timers.js:436:11)​​Here's the relevant code... myCSVArray = []; = this array contains 100,000+ rows of CSV data... var updateFiretrucks = () => { var i = 0, j = 0; console.log("Updating Firetrucks..."); myCSVArray.forEach((row) => { var exists = false; strTruck = row["Engine Name"]; for(i = 0; i < lsFiretrucks.length; i++) { if (typeof lsFiretrucks[i] !== 'undefined') { truck = lsFiretrucks[i]; } if(strTruck === truck) { exists = true; } } if (!exists) { models.Firetruck.findOrCreate({ where: { Title: strTruck} }) .spread(function (truckResult, created) { lsFiretrucks.push(truckResult.EngineName); lsFiretrucksID.push(truckResult.ID); if (created) { console.log(truckResult + " added to the database."); } }) .catch((error) => { console.log(error); }); } }) } I've looked through every forum, web site, and whatnot, and I DO see how Sequelize 5.x was supposed to solve the very issue I'm having.My connection pooling options look like this:"pool:": { "max": 1000, "min": 0, "idle": 650000, "acquire": 1000000 } Connection pooling seems to be the issue that comes up a lot, but setting mine to reasonably high values, and then the sky-high-probably-don't-work values you see here haven't produced favorable results.I added a few arrays to first check if the values in the array (from the csv), have already been seen, and if so, we can skip the whole database / sequelize stuff. Either it's not being called right, or being called once, but I'm getting duplicated results inside of the database... which I understand... because I can see the commits start in the console, more commits start, and then some of the original commits ending, before the first few have ended. Which is screwed-up. :)I've been reading through the Node documentation about streaming, pipeline, and backpressuring... but it's like knocking on dead wood right now - I've been at this for 13 hours.Help? Please?

Submitted March 22, 2019 at 02:45AM by YourQuestIsComplete

[Question] Oauth2 Node js setup

Hello,​I am looking to find the easiest and simplest solution to setting up an oauth flow for google analytics. I haven't had any luck with existing tutorials. We want to use node.js to easily implement an ouath2 sign in button.

Submitted March 22, 2019 at 01:42AM by weupquestions

Saco - pre configured express.static

short versionStop hosting static webpages with development servers and with non-production settings.Use this instead: https://github.com/bertolo1988/sacoSorry for chilling my own project but i think it is quite useful. I have been using it for 2 years.long version, for those who are learningImagine you have a react project and you want to deploy it. You will produce a folder with static content ready to be hosted. What tool should you use to host it? Nginx? Aren't you done with Chinese Gov backdoors geez... Use Node.js instead!Imagine your static content is inside /build, this would be your runServer.js:const path = require("path"); const Saco = require("saco"); new Saco.Server({ name: "my-crazy-front-end-project", rootPath: path.join(__dirname, "/build"), ip: "0.0.0.0", // not needed unless you intend to run this inside a docker container port: 4200 }).start(); Run node runServer.jsand voilá. It's running, but you won't see nothing unless you set DEBUG=saco:* node runServer.js.I heard you like Docker...The container code for most front end projects should be something like:FROM node:8-jessie # Create app directory RUN mkdir -p /usr/src/my-crazy-front-end-project WORKDIR /usr/src/my-crazy-front-end-project // copy everything else inside the container COPY . /usr/src/my-crazy-front-end-project RUN npm install EXPOSE 4200 # Start the app using npm run start (`DEBUG=saco:* node runServer.js`) CMD [ "npm", "run", "start" ] Build it:docker build -t my-crazy-front-end-project:1.0.0 .Run it:docker run -p 4200:4200 -d my-crazy-front-end-project:1.0.0

Submitted March 21, 2019 at 11:32PM by yarauuta

Creating a library that can upload files from both the backend and frontend?

A service I run has an API endpoint that allows people to upload files using multipart/form-data standards. I'm currently attempting to build an SDK for this service and I'd like to have this SDK work on both the front-end and the backend (as many libraries do).​I can't use things like fs on the frontend, and I can't things like FormData on the node apps. Which makes things interesting.​I'm curious if there's a commonality between front-end and backend uploads that I can exploit to make this happen. Ideally I'd like to avoid just having a dumb function that takes a multipart body to send off via axios, since this kind of defeats the purpose of having an SDK in the first place.​Is this a fools errand?​thanks in advance for any advice!

Submitted March 21, 2019 at 07:51PM by RockBand2

Endtest - Creating a test for Google Maps

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

Submitted March 21, 2019 at 04:46PM by wernerklaus

String Replace in JavaScript

https://thecodebarbarian.com/string-replace-in-javascript.html

Submitted March 21, 2019 at 04:49PM by code_barbarian

[Question] How to use node modules in different situations ? (mainly in the web)

So recently I have been getting into programming with es6 and nodejs, but I have been getting confused with how to use node modules and could not really find a source that answers my questions.I understand that if you have a local js file on your computer than you can simply install a module with npm install and then use a require statement. However, I also have seen that require is not supported in browsers.I have spent a lot of time researching and trying to figure out how people use npm and node in the browsers.using express js to have a front end and a backend that are linked togetherBrowserify to bundle all of your modules together and then load the bundled js file into your main html file.Basically I guess I don't understand how to use npm modules once the web is involved.Then there are cases where a web specific framework is supposed to be installed using npm, but then I don't know how to require it. Or if I use browserify to load the module in it has no access to the backend and server side.I have also heard about other services such as Commonjs, requirejs, webpack, etc.I'm just not really sure when to use what and was hoping someone would be able to give me a better explanation or point me to a resource to help me out.I think a good example of something I was trying to do once was use the fs module to read a json file and then display the parsed data to my webpage, but I didn't know how to link the backend and front end.edit: added an example

Submitted March 21, 2019 at 04:50PM by vin42tau

🏞mississippi streams collection 4.0.0 released 🏁

https://github.com/maxogden/mississippi

Submitted March 21, 2019 at 04:55PM by bongobret

[Help - Beginner] Integrating Node into static webpage

Hey all,I created a static web page that is hosted on github pages and I'd like to add a functional form element (along the lines of a "contact me for more info" section). I understand the basics of using Node (express, mongoose, etc.) and connecting to Mongodb. All is good in so far as I've created a Node.js app that performs the simple functions I want (posting data to the database), I just have no idea how to get that code running on my static page. All the tutorials I come across regarding building a form submission element entail building the app from scratch and just running the project locally, which doesn't really do me any good. I feel like I am missing a large step in how to actually use that in practice and deploy it on a page.I'm a front end guy, so I really don't know how to integrate back-end tech into a page.Any pointers in the right direction would be helpful. I don't really want to just install a package that accomplishes this or use Wordpress because I really want to understand what is actually going on so I can build and understand them better in the future.

Submitted March 21, 2019 at 04:08PM by Outrunx

Easily launch the Chrome or VS Code Debugger by adding a single line to any Node application (even the REPL)

https://github.com/hediet/easy-attach

Submitted March 21, 2019 at 04:16PM by Gehinnn

Firebird high-level native client for Node.js / TypeScript updated to v0.1.3

https://www.npmjs.com/package/node-firebird-driver-native

Submitted March 21, 2019 at 02:56PM by mariuz

Not sure why it didn't exist before now, I just published a Blob shim for node.js

https://www.npmjs.com/package/node-blob

Submitted March 21, 2019 at 01:40PM by shakamone

Loopback node and mongodb

I'm new to this type of interfaces, so I was wondering, what is the best tutorial to help me create a website with the three interfaces mentioned above?

Submitted March 21, 2019 at 01:13PM by christ28

how does passport-local module work?

I am kinda new in node. recently I decided to create a blog system and it has an authorization system which is created by passport module and local strategy. I used passport documentation and some video tutorials to design it but I can't understand how does it work, I don't understand the logic. I have a login form which has two fields (username,password) and a submit button. you can see my login.jade code here. it is written in jade templating language and used semantic-ui(something like bootstrap).-------------------------------------------login.jade---------------------------------------------- form.ui.form(method="POST",action="") div.field label Username div.ui.left.icon.input i.user.icon input(type="text",name="username",placeholder="username") div.field label Password div.ui.left.icon.input i.lock.icon input(type="password",name="password",placeholder="password")button.ui.primary.button(type="submit") log-inalso here is my passport local strategy------------------------------------------localStrategy-------------------------------------------- passport.use(new localStrategy(function(username,password,done){ User.checkUserName(username,function(err,user){ if (err) throw err; if (!user) { console.log('unknown user'); return done(null,false,{message:'user not found'}); } if(user.password!=password){ return done(null,false , {message : 'password is wrong'}); } return done (null,user); }); }));checkUserName is a function in my models (user.js) which finds the username in the database.-------------------------------------------checkUserName------------------------------------------- module.exports.checkUserName= function(username,callback){ User.findOne({username:username},callback);}now I don't understand how does the localstrategy work. how does it understand which field in my login form is for username and which field is for the password? it only accepts two arguments (username,password) but i dont know how it specifies where are these arguments come from and how it understands that these must be my login form credentials. I would be very thankful if someone explains to me what is happening here.

Submitted March 21, 2019 at 11:21AM by daniad7

[Help] Node Seneca Moongose behavior

Hi. I am new in Node and I am having some strange between Seneca and Mongoose.You can check the repo here. I already explain there what is happening - see README.md.tl;dr: Why the script behaves differently with and without Mongoose against 'exit' signal emitted by Seneca?

Submitted March 21, 2019 at 11:36AM by SlideToUnlockiPhone

Drawbacks to Child Processes?

I was wondering, aside from the amount of time it takes two processes to communicate through IO, are there any real drawbacks to using child processes for all functions that might take a relatively significant amount of time? I feel like, if they open the door to, essentially, multithreaded apps, without actually being a multithreaded language, you'd see them all over. Why don't you? Presumably there are some drawbacks, but maybe most apps just don't require it?

Submitted March 21, 2019 at 11:44AM by BurnerCell23

The Node.js Master Class Review

I tried to attend the online course The Node.js Master Class and this is how it went.Did anyone here have similar experience? Is it OK to write this publically?

Submitted March 21, 2019 at 11:27AM by lukas_cech

Hi redditors! If you want to add some simple analytics to your *nodejs/express* app (requests count, status codes, etc) please let me know. I'm developing a service specially for nodejs/express apps and looking for early-bird users.

https://i.redd.it/y8a6lt0s6gn21.png

Submitted March 21, 2019 at 10:17AM by sochix

Google App Engine now supports Web Sockets!

https://cloud.google.com/blog/products/application-development/introducing-websockets-support-for-app-engine-flexible-environment

Submitted March 21, 2019 at 09:26AM by gijovarghese

What kind of Load Balancer which PM2 used?

Their document just talk about guide and another things without explain what kind of load balencer they used? Can someone explain for me? Thanks

Submitted March 21, 2019 at 08:53AM by thangtv611

[Question] Any slack, gitter or similar chat service for node devs?

I am new to Node and i want to ask few devs with some problems i encounter during development. Maybe other devs encountered my problems and can help me with them.

Submitted March 21, 2019 at 07:35AM by SlideToUnlockiPhone

he - a robust HTML entity encoder/decoder written in JavaScript

https://github.com/mathiasbynens/he

Submitted March 21, 2019 at 08:26AM by fagnerbrack

Use Docker to Create a Node Development Environment

http://dev.thegeeknews.net/236333af5a

Submitted March 21, 2019 at 07:10AM by AllysonLitvin

Wednesday 20 March 2019

Wouldn't it be great if we could install a Google Firebase on any cloud and on any database?

No text found

Submitted March 21, 2019 at 01:36AM by YourTechBud

Twitter Clone part 11

https://youtu.be/Yf5MimojSbg

Submitted March 20, 2019 at 03:55PM by ngovanhuong94

Great opportunity for Sr NodeJS developer in Irvine, CA

If you are ready to advance your carrer to next level, we have a great opportunity for the fullstack NodeJS Developer.This is high impact role, with a lot of room for the future growth at the marketing analytics SAAS company.Knowledge of AWS highly desirable.Apply Now

Submitted March 20, 2019 at 04:09PM by wordpill

Question! mongodb shema validation on node.js api

Hi I've a problem I need to validate my form values at api before to save data to the database​​https://i.redd.it/hz6s38clsan21.jpgI have a from like this​const postSchema = mongoose.Schema({ name: { type: String, require: true }, lastname: { type: String, require: true }, il: { type: String, require: true }, ilce: { type: String, require: true }, }) here my mongoose schema​I already made form validation but I also need API validation​modulesvar express = require('express'); var path = require('path'); var bodyParser = require('body-parser'); const mongoose = require('mongoose') ​

Submitted March 20, 2019 at 04:11PM by teriologia

NodeJs Scaling - Architecting zero downtime

https://www.tutespace.com/2019/02/nodejs-scaling-architecting-zero.html

Submitted March 20, 2019 at 05:18PM by shrinivas28

Building Structured WebSocket Backends with Hexnut

https://medium.com/@FrancisStokes/build-structured-web-socket-backends-in-node-with-hexnut-1d505c9c30b0

Submitted March 20, 2019 at 03:02PM by FrancisStokes

Practical functional patterns for async flow control with Puppeteer

https://github.com/agaricide/puppeteer-functional-patterns/blob/master/ts/puppeteer-functional-patterns.md

Submitted March 20, 2019 at 02:32PM by agaricide

A complete guide to threads in Node.js (with examples)

https://blog.logrocket.com/a-complete-guide-to-threads-in-node-js-4fa3898fe74f

Submitted March 20, 2019 at 01:06PM by anglsnt

I made a cli crypto tracker with node.js/oclif

https://github.com/navdeepio/coin

Submitted March 20, 2019 at 01:28PM by hackfall

is there a difference between _id n objectid

i want to set the objectid manually, from the node express appbut when i change the _id it appears in document"_id": "helloworld",but in auto update,it appears to be this"_id": {"$oid": "5c922cf660724f0b8a124015"},​so is there any difference between _id n the second 1because i will be doing find based on _id​

Submitted March 20, 2019 at 12:28PM by aminnagpure

help using variables set in function

Hello, I need some help using variables defined inside function. example:​var idfirstFunction(value1, value2, function(returnedId) {id = returnedId})secondFunction(id, value)​how do i access the returnedId from the first function and use it inside the second function?

Submitted March 20, 2019 at 12:04PM by mrtnk

How to convert javascript objects into an array of javascript objects with node.js

Hello Reddit community,​First time poster, long time reader.​I am very new to node.js so please be gentle :)I am trying to write a fun server-less app within AWS in order to learn node.js.​I have no issues writing data to my DynamoDB table.​The issue I am facing is that I am using the following method to scan the database to get a list of email addresses:​const AWS = require('aws-sdk'); const docClient = new AWS.DynamoDB.DocumentClient(); const { TableName } = process.env; exports.handler = (event) => { var params = { TableName: TableName, ProjectionExpression: "#email, USERID", ExpressionAttributeNames: { "#email": "email" } }; docClient.scan(params, onScan); function onScan(err, data) { if (err) { console.error(JSON.stringify(err, null, 2)); } else { data.Items.forEach(function (itemdata) { const itemdataEailArray = []; itemdataEailArray.push(itemdata.email); console.log(itemdataEailArray); }); if (typeof data.LastEvaluatedKey != "undefined") { console.log("Scanning for more..."); params.ExclusiveStartKey = data.LastEvaluatedKey; docClient.scan(params, onScan); } } } } ​This returns the following:[ 'lo2l@lol.com' ] [ 'woooooooooooo2@wooooooooooooooooo456789oo2.com' ] [ 'hello@hello.com' ] [ 'lo2l@lol.com' ] [ 'hello@hello.com' ] [ 'lol@lol.com' ] ​​How can I convert that out put to a javascript array that looks like:[ 'lo2l@lol.com', 'woooooooooooo2@wooooooooooooooooo456789oo2.com', 'hello@hello.com', 'lo2l@lol.com', 'hello@hello.com', 'lol@lol.com' ] ​Its the last thing I need to do for my back end functions to get it all working.Any help is much appreciated in advance.​​

Submitted March 20, 2019 at 12:06PM by zadowsmash

The Definitive Guide to Web Scraping with NodeJs & Puppeteer

https://learnscraping.com/nodejs-web-scraping-with-puppeteer/

Submitted March 20, 2019 at 09:33AM by dobkin-1970

Tuesday 19 March 2019

Node.js / Javascript performance coding tips to make applications faster

http://go.geeklearn.net/327206f452

Submitted March 20, 2019 at 03:09AM by MarkOliver908

Help to figure out program design?

https://www.reddit.com/r/learnprogramming/comments/b35gea/help_to_figure_out_program_design/

Submitted March 20, 2019 at 12:50AM by jsdfkljdsafdsu980p

Why are Weakmaps in Javascript not Enumerable?

https://www.thedreaming.org/2019/03/19/weakmaps-in-javascript/

Submitted March 19, 2019 at 10:53PM by jwalton78

Run-rs mongoose

I’ve posted on here about transactions, and thanks to some people, I was able to work with mongoose transactions. However, it uses something called run-rs for a replica and I’m COMPLETELY new to the term and everything behind the scenes of it. Anyways, I find that when I restart the dB using “run-rn —mongod” everything is gone. No collection, no data, no nothing. I’ve looked online but found nothing and I’ve been at this for at least 5 days now. Is there a way I can use the run-rs module and not lose my data just because of a restart of some sort?

Submitted March 19, 2019 at 09:22PM by r_gui

Should you handle uncaughtException in server applications?

If you have an error in anything that's called from a route (e.g. koa or express), your error route middleware will catch and handle it. And if you have an error anywhere else, it should be thrown at initialization time right?Will uncaughtException event ever occur in server applications once the server has already started up successfully? What's an example where this could occur?So do we need an uncaughtException callback and if so what should we do in it?

Submitted March 19, 2019 at 06:37PM by nowboarding

Which Open Source Projects Use NodeJS Well?

I like trying to read over libraries like Lodash to better understand JavaScript. Likewise, I want to better understand how NodeJS works, especially with MongoDB and Express.So I'm wondering if there are any open-source projects that are well structured and the like that would be good to look at to see Node in action.

Submitted March 19, 2019 at 07:05PM by cpustejovsky

Database to CSV

A project I'm working on grabs product data (in 100-product chunks) from an external API. I then need to create a CSV of the product data. There are upwards of 80,000 products. Any advice on how not to use gobs of memory? I've considered using Streams API but don't know if I'm barking up the wrong tree. Currently the application fails based on memory constraints.​Current overview// Grab list of item ids // Batch ids in 100s // Throttled concurrent requests using Bluebird.js (5 at a time) // Usually fails at this point, too much memory consumed storing all the responses // Once all product data is retrieved, convert [response.data](https://response.data) to CSV // ftp upload csv to remote server Any advice would be much appreciated, I've never worked with this much data so optimization hadn't become an issue, and my current set up is obviously not scaleable. It runs locally, albeit slow, but I'm sure there are better ways to do this.

Submitted March 19, 2019 at 07:24PM by jfirwin

Node.js backend framework for production?

Hi people,Anyone using JS frameworks for production? The stack will be Angular 7, PostrgreSQL/MySql and ...?I have tried Loopback 4 for a few days but it's not production ready imo.Could you recommend anything? Is express production viable? What are our other options?​Thanks

Submitted March 19, 2019 at 05:52PM by lip3k

Twitter Clone part 10

https://youtu.be/5MJGAeCEiwc

Submitted March 19, 2019 at 05:05PM by ngovanhuong94

My approach to documenting JavaScript projects

https://softwarebrothers.co/blog/my-approach-to-documenting-javascript-projects/

Submitted March 19, 2019 at 02:59PM by lysywojtek

Announcing NestJS 6: What’s New?

https://medium.com/@kammysliwiec/announcing-nestjs-6-whats-new-38959d94221f

Submitted March 19, 2019 at 03:42PM by mysliwik

My approach to documenting JavaScript projects

https://softwarebrothers.co/blog/a-full-approach-to-document-javascript-projects/

Submitted March 19, 2019 at 02:14PM by lysywojtek

Suggest an open source project in nodejs with mongodb as database and testing done with jest

I am working on nodejs application with database as MongoDB connected using mongoose, I am assigned to write integration tests with jest. need an open source project I could refer to for learning.

Submitted March 19, 2019 at 01:00PM by codexdelta

When "Zoë" !== "Zoë". Or why you need to normalize Unicode strings

https://withblue.ink/2019/03/11/why-you-need-to-normalize-unicode-strings.html

Submitted March 19, 2019 at 01:33PM by r-wabbit

Node server hangs up when calling a request multiple times.

So I am making a login form for my website and when calling the /submitlogin post request it hangs up after few times 5-6. It doesn't matter if I change the input or not. Strangely it hangs outside this function and not while executing it.Here is the functionBasically, it accepts a form with name:,pass: and ask the SQL server a user with those exists. Gotta fix this before moving forward. Using Formidable, Express, Object-Hash.app.post('/submitlogin', function (req, res) { var form = new formidable.IncomingForm(); form.parse(req, function (err, fields, files) { var passhash = hash(fields.pass); console.log(fields.name, passhash); var sql = "SELECT * FROM `database`.users WHERE name='" + fields.name + "' AND passwordHashed='" + passhash + "';" con.query(sql, function (err, result) { if (err) throw err; console.log(result); }); }); }); No other function has this problem so I assume it is exclusively from this one but after hanging it doesn't hit this function in a breakpoint, so I assume this function must be faulty but why can't figure that out.Here is all the code.https://pastebin.com/2fCdkkYNThanks for the help!

Submitted March 19, 2019 at 11:44AM by emelrad12

How to send periodic notifications from node server after checking a postgres database without cron jobs.

Hi, I have a node server that handles checkins and chekouts of its users. Once a user checks in how can I send notifications to the user after every 30 minutes reminding them to checkout. I can't use cron jobs because if the server restarts it might mess up the notifications. Is there any way to implement this without using cron jobs.

Submitted March 19, 2019 at 11:28AM by HoloCroc

Fullstack - Node.js Developer - London

Check it out - - https://functional.works-hub.com/jobs/front-end-javascript-developer-in-london-united-kingdom-ea5f4

Submitted March 19, 2019 at 10:04AM by alexmesro

How to Build and Deploy a Cloud Native Node.js App in 15 minutes

https://medium.com/@RisingStack/how-to-build-and-deploy-a-cloud-native-node-js-app-in-15-minutes-7b540f7fde14

Submitted March 19, 2019 at 09:18AM by hfeeri

How to Set Up a Node Project With Typescript?

http://on.geeklearn.net/bd56ff9481

Submitted March 19, 2019 at 06:55AM by Nancyannh

Monday 18 March 2019

Node subdomains

Hi I was wounding if you could tell me how to transfer a user from one file to anotherfor example the entry is index.js and if the url is app.domain.ca/log the user initially enters index.js then gets transferd to app/main.js​and main.js will act as the entry point for the sub domain​file structure example​index.jsapp- main.js​sorry if this is a noob question

Submitted March 19, 2019 at 05:29AM by Isaac_Cool

Using find and regex with an array of documents in Mongo DB.

Hello all,​I have a collection of objects that are like the example below named adminslocals{ "_id":"5c8ec7420472bc874c30632b", "hostname":"p51", "dateAdded":"2019-03-17T04:00:00.000Z", "adminCount":2, "admins":[ {"_id":"5c8ec7420472bc874c30632d","Name":"P51\\Administrator"},{"_id":"5c8ec7420472bc874c30632c","Name":"P51\\saiello"} ], "__v":0 } ​db.adminslocals.find({ hostname : /p/ }) will bring back the documenthowever if I use the following syntaxdb.adminslocals.find({ admins.Name : /P/ }) brings nothing back....​also tried db.adminslocals.find({ "\`admins.Name``" : { $regex : "/Administrator/" }})` with no results​Does this syntax not work on an array? I'm new to Mongo, and I don't see much documentation on querying arrays of documents.​Kind regards​

Submitted March 19, 2019 at 03:41AM by sma92878

gravatar-favicons: (email address) => { every favicon format imaginable }

https://github.com/bcomnes/gravatar-favicons

Submitted March 19, 2019 at 03:56AM by bongobret

Keep Calm, and Keep Coding with Cosmos and Node.js

http://go.geeklearn.net/da133fb1f6

Submitted March 19, 2019 at 03:04AM by GariSingh

Chaining Module or DYI Chain

https://old.reddit.com/r/javascript/comments/b2remz/chaining_module_or_dyi_chain/

Submitted March 19, 2019 at 02:10AM by bigorangemachine

power: The (cheated) interactive CLI for npm

https://github.com/jesusprubio/pwr

Submitted March 18, 2019 at 10:00PM by jesusprubio

Twitter clone using MERN

https://youtu.be/yV9LpqqZOXM

Submitted March 18, 2019 at 06:39PM by ngovanhuong94

Nodejs webstorm error

I have node installed, in my program files. Within webstorm I attempt to connect to my SQL database and output a message once connected.I cannot run the js file of my code: it returns the path of the installed npm with a message that says it cannot be executed in the path of my code file.Does my code file have to be within the node folder?EDIT: Fixed - anyone else having issues make sure you installed the correct version of node 32/64 bit!

Submitted March 18, 2019 at 06:58PM by idkwhyimheretbh420

Tip #4: How to assess your npm project health and call the doctor! - cute npm commands you probably didn't hear about

https://dev.to/lirantal/assess-your-npm-project-health-and-call-the-doctor-4hej

Submitted March 18, 2019 at 07:00PM by lirantal

Live MBTA subway traffic visualization

Was thinking of using nodeJS to try to tackle doing something like this the MBTA has an API I can use to get the data I need to use to tracking the subways:https://www.mbta.com/developers/v3-api​I figure I can use google maps somehow to take that data and put it on a map. I just not really sure how best to get started if anyone has any ideas let me know.

Submitted March 18, 2019 at 07:22PM by Limeman36

Installing And Using npm Modules

I've got a simple question, I've node.js, npm and the modules installed, but I still can't use them.I've tried installing the modules globally, although it didn't help.I used require('module_name') and I ended up with the error code: 'MODULE_NOT_FOUND'.For example, I have the module 'colors'.OS: Windows.Much appreciated!

Submitted March 18, 2019 at 06:27PM by StrikingLifeguard

Interested in NodeJS fulltime job in Irvine, CA?

We have a great opportunity for experienced hands-on NodeJS Developer, interested in a high impact role at rapidly growing profitable startup.Other skills are working on AWS and MySQL knowledge.Great salary and benefits!View Job Post

Submitted March 18, 2019 at 05:29PM by wordpill

How to stop redirecting when sending back res.json() in POST request.

I'm having trouble on how to stop a page from redirecting when sending back a response from a POST request. I've already set event.preventDefault() in my form during a submit event. The redirection only happens if I use res.json() or res.send(). I'm using expressJS btw.​P.S. It's already 12 a.m. here in my timezone, so I'm sorry if i won't be able to reply to your answers immediately.

Submitted March 18, 2019 at 04:23PM by disymebre