Friday 31 May 2019

Cant figure out this chain of promises

Im basically trying to chain promises in a for loop in order to query data from a online database. A detailed version of my question is posted on stack overflow: https://stackoverflow.com/questions/56403100/how-to-chain-promises-in-series-in-a-while-loop

Submitted June 01, 2019 at 01:58AM by DanMan259

npm init - What is the 'entry point/main' used for?

It looks like: https://gyazo.com/2ed699908dc00f16aa89deeef86bdb1d​It's stated that​> Sets the entry point for the package.When you import this package in an application, that’s where the application will search for the module exports.​​I'm not sure what it means. Does it matter if it's any JS file?

Submitted May 31, 2019 at 11:24PM by badboyzpwns

Can't figure out why POST is not working correctly.

This problem has me confused, because I have other POST pages working. But I am trying something new, doing a POST request within Javascript instead of just HTML form data.I am working in Node / Express, Javascript and Jquery.So first, my GET code which works fine. It pulls a column from a test PostgreSQL database, and sends it to an EJS page. In App.js I have:app.get("/test-page", function (req, res) { client.query("SELECT stockdate FROM chartdatabase;", function (error, result) { res.render("test-page", { result: result }); }); });Then I have a totally separate EJS page for POST, and it has a

Early Preview of Pipedream, a tool to build data pipelines using Node

Hi y’all,My name is Dylan and I’m a founder at Pipedream. We’re building a tool to help you collect, transform and route data using Node.js, for free, without managing any data infrastructure or cloud functions.I wanted to share an early preview of the app to get feedback from the JS community. We’re humbled to release this publicly, and open to any and all feedback for how we can improve it to help you build cool stuff.I recorded a short video showing you how to create your first pipeline on Pipedream. I also wanted to share a few template pipelines — you can fork any of these into your own account to run them — as examples of things you can do today:Send new Github issues to Slack (pipeline from video tutorial)Send any webhook to Discord (Stripe example)Query Segment data using SQL in < 5 minutesSend webhook / HTTP data to S3Send JSON to a pipeline and query it with SQL in minutes, without setting up a database or other data warehouse infrastructure.We’ve adopted a notebook-like interface for editing code, similar to tools like Observable or Runkit. All notebooks (pipelines) are public, so anyone can find and use a notebook you’ve written. The data you send to your pipelines is completely private.Think of us as a Github for data pipelines: find a notebook that solves your use case, fork it, and run it in your own account.A few more things to know:Running pipelines is free. In turn, we’ve imposed some limits on pipeline volume and the runtime environment for Node code during the preview. If you find these limits restrictive, let us know!All pipeline code is public, but the data you send to pipelines is private. Since code is public, you should store any sensitive values like API keys in environment variables.We support Node 10. You can use npm packages just by require-ing them in a code cell. See the docs on code cells for more detail on how to use Node code on Pipedream.We have a long way to go and have a lot of features on the way, but in the meantime, give it a try, build some pipelines, and let us know what you think!

Submitted May 31, 2019 at 10:52PM by dylburger-pipedream

Introducing PureORM - the first pure ORM for node

https://github.com/craigmichaelmartin/pure-orm

Submitted May 31, 2019 at 09:37PM by sammrtn

What are your favorite organization management libraries?

I'm talking about libraries that make it simple to manage organizations, where each organization has multiple users. Python has django-organizations - is there a similar library for Node?

Submitted May 31, 2019 at 07:33PM by i47

Need help (software architecture)

Hello, I have basically no knowledge of queuing (and software dev. in real life) , and I need to implement in node the following use case :A backend server (Nodejs/Typescript) would send requests to one or several externals API, and process data. The request would be made every seconds, and would be processed in less than 2 seconds.A administration frontend would be able to monitor and control the requests sent to external API (destination, rate, processing options)Is queuing scheduled tasks with a lib. like bull a good option ? Am I going in the good direction or should I choose something more simple ? (I'm afraid of overdoing something there)

Submitted May 31, 2019 at 06:38PM by jeanreu

npm ci significantly slower than npm install

I recently switched to using npm ci instead of npm install when testing my system. I used time ./my-script.sh to see how long it takes to build the project and get it running. Running a single npm install seems to be slower than running a single npm ci, but my script (which has to run npm ci/npm install few different directories) is on average 20 to 30 seconds slower if it uses npm ci. Isn't it supposed to be much faster? How can I improve the speed?Also, having to use multiple installs might be bad practice (there are several package.json/package-lock.json files and node_modules folders), but it seems necessary due to the amount of subprojects and subsystems within this one. I'm pretty new to this, but I don't know how I could make it so you can just run npm ci once in the root directory to take care of all of them.I'm probably going to use Yarn later, but I'm not sure why I'm having this issue now. Any ideas?

Submitted May 31, 2019 at 04:09PM by CronosDage

Simple package.json style IOC container for Node

I created an IOC container designed with simplicity and familiarity to package.json in mind. This was created to be the simplest possible way of mapping modules to their respective dependencies. Feedback on what people think of the dependency declaration-style as well as design decisions (such as auto-instantiation instead of the common factory-pattern), as well possible contenders that do the same (thus rendering it redundant) would be much appreciated. If anybody would like to comment on the technical implementation that would also be great (such as the subscriber-based dependency resolution). I think the performance could probably be increased by the use of certain log-n tree structures (instead of iterating as much as is currently done), or possibly priority queue for faster leaf-finding.Here is the package: https://www.npmjs.com/package/nano-container

Submitted May 31, 2019 at 01:45PM by booleantoggle

🛑 You don't need passport.js - Guide to node.js authentication ✌️

https://softwareontheroad.com/nodejs-jwt-authentication-oauth?utm_source=reddit&utm_medium=subreddit

Submitted May 31, 2019 at 01:30PM by santypk4

Say hello to `npm i am`! 🥳 `am` can run your main function asynchronously

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

Submitted May 31, 2019 at 11:00AM by hanifbbz

5 Programming Patterns I Like

https://www.johnstewart.dev/five-programming-patterns-i-like

Submitted May 31, 2019 at 09:49AM by fagnerbrack

Security Question Regarding Web App

Hi, I'm trying to sell/provide a web application to my school. It's basically a small clock app which tells students how long they have till next period etc. I would like it to be embedded into the main school website via an IFRAME, but some IT technicians at my school are having security worries. They state that they have internal policies on third party apps, and that Node.js itself is "not secure at all". They referred to something called a CVE list (Is this it? https://www.cvedetails.com/vulnerability-list/vendor_id-12113/Nodejs.html) Are there any other security issues I should be worrying about?​My app does not have any forms, anywhere where user can enter in data and does not use cookies. It stores no data from users whatsoever. The only three npm dependencies I have are express, ejs and googleapis. How can I convince them that it would be safe? Any help is appreciated.

Submitted May 31, 2019 at 10:04AM by ThatOneIncident

How to create/build/compile (?) a github repo?

https://github.com/steemit/steem-js​i want to use this library, but the minified version they provide is outdated. so i need to compile it again.i can't figure out how to do it.​i just want to have the finished JS.

Submitted May 31, 2019 at 09:23AM by kallebo1337

Reverse a stack using recursion in javascript.

https://learnersbucket.com/examples/algorithms/reverse-a-stack-using-recursion/

Submitted May 31, 2019 at 07:26AM by know_prashant

Are there any books that tell you how the entire node system works

For example:Structure of packagesPackage registryLinking packagesetc

Submitted May 31, 2019 at 08:03AM by Administrator101

Thursday 30 May 2019

[Discussion] How do you maintain the exact version of packages to be installed across OSes?

ScenarioAt my company, developers use MacOS and we use yarn to manage dependency. Production runs on Ubuntu 14.04.I understand that once you run yarn install, yarn.lock file is generated, which specifies the exact version of each package in your project (this is different from package.json which may not specify an exact version but a range).I had thought that the packages in yarn.lock file only depends on two things: * nodejs version at the time the yarn.install was run * package.json fileHowever I was wrong. Apparently, the packages in yarn.lock are also OS dependent. I knew this when I accidentally did the following: 1. On Ubuntu 14.04, nodejs 6.10.0, runs yarn install -> a yarn.lock file is generated. 1. Copy that yarn.lock file onto MacOS which also runs nodejs 6.10.0. Runs yarn install --frozen-lockfile.The result was that the installation worked on Ubuntu (where the yarn.lock file was generated) but failed on MacOS even though I use the same node version on both OS.Question How do you make sure the exact versions of the packages work across OSes, especially native ones (like node-rdkafka I think)?

Submitted May 31, 2019 at 03:39AM by devops_wannabe

What is the best way to deploy a MEAN app locally?

I have a MEAN app that I'm at the point where I need to start thinking about deployment.This will only need to be used locally. What's the best way to achieve this?

Submitted May 31, 2019 at 03:14AM by codie28

MyOS - Develop and Share Terminal Environments

https://www.cdevn.com/my-os

Submitted May 30, 2019 at 11:28PM by rylandgold

Serverless CRUD API using AWS Lambda, DynamoDB, API Gateway and Node.JS - First Class JS

https://firstclassjs.com/serverless-crud-api-using-aws-lambda-dynamodb-api-gateway-and-node-js/

Submitted May 30, 2019 at 08:53PM by FirstClassJS

ssh2-sftp-client or alternative question to slow down the connection

Hi,I am working on creating a tool that allows to sftp from location to another using https://www.npmjs.com/package/ssh2-sftp-client library. The issue that I am running into and trying to figure out how I can throttle the download speed either by a percentage or by a fixed amount like 5 Mbps to avoid maxing out the network link. Has anyone experienced this or has some pointers or ideas on how I can accomplish throttling of the sftp session?

Submitted May 30, 2019 at 07:00PM by psychephylax

TROOL - a spreadsheet rule engine for NodeJS/TypeScript

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

Submitted May 30, 2019 at 07:23PM by TheWebDever

Tutorial: Build a Social Network in JavaScript with Graphs! - Hinsencamp

https://hinsencamp.com/article/social-network-graph/

Submitted May 30, 2019 at 04:46PM by fahinse

nTennah's weekly node newsletter

https://www.ntennah.com/issue/nodeHighlights from this week's node.js newsletter, subscribe and get the complete list of this week's important and influential content.JavaScript Open Source for the Past Month (v.May 2019)pm2 caused thousands of CI builds to fail because of an "optionalDependency" on a package called gkt which is requested as a tarball from a server that was returning 503. That package consists of one file which contains this: console.log('Smarty Smart Smarter');Introduction to Icon P-Rep Node Campaign. Largest South-Korean BlockchainGet count of array objects belonging to a partical ID in JavaScript/Node js

Submitted May 30, 2019 at 02:35PM by ntennah

How to use Machine Learning to fix tests

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

Submitted May 30, 2019 at 01:08PM by jos_cu_klaus

Is there any reason not to use Prisma?

Used to develop my backend using MongoDB and Mongoose. I recently stumbled upon Prisma and so far it seems that it does everything Mongoose and MongoDB can, but better and simpler, it even supports GraphQL and MySQL. Is there really any reason to use MongoDB and Mongoose VS Prisma.​I also like the idea of learning Prisma once and deploy to GraphQL, MySQL, and MongoDB depending on requirements.

Submitted May 30, 2019 at 01:58PM by divinecake

Why there isnt anymore discussion about AdonisJS?

I am single developers that will build back end stuff as well as front end stuff. I started using Adonis while ago and it has been amazing! It has been rather simple to use and you can produce clear code with it. Most importantly, it seem to have solid protection against malicious attacks. That reason I moved my whole code behind AdonisIt baffled me that developer patriot only gets about 250 dollars per month. Why people is not using it more?I guess express is most popular to build on, but for smaller team, framework like adonisJS is gold. PHP framework Larvae is super popular, so I would expect people would appreciate same things on node also, but that not seem to be case.Any thoughs?

Submitted May 30, 2019 at 12:31PM by kampinisu

Node.js 10.16: Small update for LTS version

https://helpdev.eu/node-js-10-16-small-update-for-lts-version/

Submitted May 30, 2019 at 11:53AM by helpdeveu

How do you read file and send it to a function?

I'm trying to find a way to get file from user via file upload and send it to a function which converts the file into base64.Here's the function:var into64 = (fileLocation) => { var myFile = fs.readFileSync(fileLocation) return new Buffer.from(myFile).toString('base64'); } ​What could be the possible solutions?

Submitted May 30, 2019 at 09:48AM by pverma8172

🔥 Create Web App : Your New project buddy 💪

Create Web APPWe Need your Support. Please Do support us with a Star and with your helpfull contributionsRepo Link .This package is a simple node CLI tool based on yeoman generator which when run will simply ask you some simple question and then will generate a simple starter project to kickstart your developmentCommands: $ npm i -g @buildtip/create-web-app $ cwa Please Do Contribute to this project and feel free to Raise PR and Issue

Submitted May 30, 2019 at 09:19AM by r00t_aXXess

Wednesday 29 May 2019

Learn how to format phone number in javascript

https://learnersbucket.com/examples/javascript/how-to-format-phone-number-in-javascript/

Submitted May 30, 2019 at 07:41AM by know_prashant

Possible to use both yarn and npm?

Is it possible to use yarn and npm on a single project?Actually, I’m currently using npm in my Laravel project. There is this one package that I can’t install using npm but works when installed with yarn.So back to the question, is it possible to use both in my project? Are there any issues that might break something in my project?

Submitted May 29, 2019 at 10:32PM by mrcloudcat

Running a bot and website on same server

I made a discord bot and want to add a website so they can work together.I'm running a bot right now with ec2.Is it okay to add my website in the same terminal as my bot?

Submitted May 29, 2019 at 11:02PM by ssjcracker

Passport Local Strategy login/register wont redirect and displays “Bad Request”

I'm trying to authenticate Users with a Passport local Strategy. When Registering a user, the user is created in the DB, but is not redirected correctly. It just sends a "Bad Request" in the browser. Same thing happens for Logging in--just a "Bad Request". Cookie is still created and the user is actually logged in, just not redirected.Most of the code is from a Udemy Course, and it works flawlessly in another Project I tried it. It is literally the same code.All npm packages are installed in Package.json.Here is my app.js:​const express = require("express");const bodyParser = require("body-parser");const ejs = require("ejs");const mongoose = require("mongoose");const session = require("express-session");const passport = require("passport");const passportLocalMongoose = require("passport-local-mongoose");const app = express();​​app.use(express.static("public"));app.set("view engine", "ejs");app.set('views', [__dirname + '/views/admin', __dirname + '/views/admin/partials', __dirname + '/views/login', __dirname + '/views/reshape']);app.use(bodyParser.urlencoded({extended: true}));​​app.use(session({secret: "secret",resave: false,saveUninitialized: false}));​app.use(passport.initialize());app.use(passport.session());​mongoose.connect("mongodb://localhost:27017/userDB", {useNewUrlParser: true});mongoose.set("useCreateIndex", true);​const userSchema = new mongoose.Schema({name: String,email: String,password: String,role: String,});​userSchema.plugin(passportLocalMongoose);​const User = new mongoose.model("User", userSchema);​passport.use(User.createStrategy());​passport.serializeUser(User.serializeUser());passport.deserializeUser(User.deserializeUser());​​​app.get("/", function(req, res) {res.render("home");});​app.get("/login", function(req, res) {res.render("pages-login");});app.get("/logout", function(req, res) {res.render("pages-logout");});app.get("/register", function(req, res) {res.render("pages-register");});app.get("/forgot_password", function(req, res) {res.render("pages-recoverpw");});​app.get("/admin", function(req, res) {if (req.isAuthenticated()) {res.render("index");} elseres.redirect("/login");});​app.get("/product-keys", function(req, res) {res.render("product-keys");});​​app.post("/register", function(req, res, next) {​User.register({username: req.body.registerEmail,name: req.body.registerName}, req.body.registerPassword, function(err, user) {if (err) {console.log(err);res.redirect("/register");} else {passport.authenticate("local")(req, res, function() {console.log(err);res.redirect("/admin");});}​});});​app.post("/login", function(req, res) {​const user = new User({username: req.body.loginEmail,password: req.body.loginPassword});​req.login(user, function(err) {if (err) {console.log(err);} else {passport.authenticate("local")(req, res, function() {​res.redirect("/admin");});}});​});​app.listen(3000, function() {console.log("Server started on 3000");});​I would appreciate any help. Thanks!

Submitted May 29, 2019 at 09:00PM by DerQualle

CLI tool to speed up development of AWS CloudFormation Stacks

Hello,I'm building a CLI tool in Node to help and speed up the development activities associated with the construction of AWS CloudFormation Stacks.https://github.com/atpollmann/cf-cli-helperIt would be awesome if anyone can contribute!

Submitted May 29, 2019 at 09:07PM by aualtopoll

NovaQL - A GraphQL Schema Visualizer Tool

Visualize complex GraphQL schemas.https://github.com/nova-introspection/Nova

Submitted May 29, 2019 at 09:24PM by DazzlingStill

I want to make a price alert app but... Need advice

Hey,​I want to make a basic bitcoin price alert app(it'll be a web app). Just like the all other crypto price alert apps on phones.​- People will choose the prices for getting alerts for- When the price hit there app will send them browser notifications​There are numerous examples for such systems, like:- https://coinwink.com/- https://coinmarketalert.com/- https://coindera.com/- https://cryptocurrencyalerting.com​and so on.But, the thing I don't know is how to design such a system. Imagine I have 1000 users. What should I do? Should I save everyone's alert price points to a database and check from there, for example, every 5 seconds if the should get a notification or not? But such a system doesn't seem like a wise way of doing this task. If I have 100k users instead and every user have 10 saved alerts that makes 1m entry to check, how can I query that database every 5 seconds? Isn't this a heavy work for a database? And another thing is I may want to decrease the checking time to 1 second instead of 5, now thing are getting more harder​​I need your advice about it, anything appreciated. Thank you.​Lastly, I'm a CSE student and I do not have so much idea of how real-world problems are solved, so that question may be absurd for you. Just want to learn how I can accomplish that problem

Submitted May 29, 2019 at 08:35PM by ofaruk

Full-Stack TypeScript template using NodeJS/Express/React with decorators for Express routes.

https://github.com/seanpmaxwell/TypeScriptFullStackShell

Submitted May 29, 2019 at 08:41PM by TheWebDever

We created an html contact form generator with Node.js and Lambda

We where not happy with current available tools for creating online contact forms so we decided to build our own - Super Easy Forms With this tool you can generate responsive and 100% customizable html forms (No iframes) with a backend deployed in an instant for free.By leveraging new technologies such as serverless, the tool allows you to create an unlimited amount of forms, store unlimited form submission, register an unlimited amount of emails, easily export submissions from the database and ,best of all, you have full control of your data. All of this for free!How it WorksSuper Easy Forms is a simple CLI built with node js. It helps you register your email with AWS SES, it automatically creates the necessary resources for you in AWS, and it outputs a Bootstrap HTML form that's already connected to your API, ready to copy paste into your website.​https://i.redd.it/a1n8xett97131.pngResources CreatedA Dynamodb table with your desired fields.A lambda function that will send an email to your registered address and add the entry to the database.A REST API endpoint for the lambda function with a POST method.The FormResponsive bootsrap 4 layoutAutomatic form fields with labelsJQuery CDNJQuery handler connected to your API endpointCustomize your FormThe CLI outputs an html file with your ready-to-use form preset with default bootstrap classes and an inline JQuery handler.You can add custom CSS, modify the HTML layout of the form and adapt it to your project however you like.If you need inspiration you can check out this collection of bootstrap html contact forms in codepen.Whats Included with AWS in Super Easy Forms?You need to have an AWS account to be able to use Super Easy Forms. In the near future we are going to solve our vendor-lock in but for now AWS is a pretty good start.Super Easy Forms uses the following services from AWS:SES Simple Email Service. 1,000 emails/month for free then $.10 for every 1,000 emails received.DynamoDB Fully managed NoSQL database. 25GB of storage free for always.Lambda Lets you run code without managing servers. 1M requests/month free always. Then $.20 per 1M requests.API Gateway API management solution. 1M REST API requests/month for 12months then $3.50/1M requests.S3 Bucket Object storage for your file submissions (Coming soon!). 5Gb free for 12 months then $0.023 for GB.Want more info? https://aws.amazon.com/freeRoadmapSuper Easy Forms doesn't stop here. We have a bunch of features planned that will make it more easy and more Super!Some of these include:File submissions (images, videos, PDFs and more!)Payment forms (integrations with leading solution providers)Direct integration with the gmail APIDirect export of submissions to XLS and CSVOptional Captcha (Spam protection)We really appreciate your feedback. Please use Super Easy Forms, we are confident you will find it very useful!

Submitted May 29, 2019 at 08:20PM by lucas_kardo

Can't install a package on NPM!!

I started learning node today and i wanted to install the Faker package. I used the commandnpm install fakerAlso triednpm install faker.jsBut I get this:​ubuntu:~/environment/Firstnode/MyShop $ npm install fakernpm WARN saveError ENOENT: no such file or directory, open '/home/ubuntu/package.json'npm WARN enoent ENOENT: no such file or directory, open '/home/ubuntu/package.json'npm WARN ubuntu No descriptionnpm WARN ubuntu No repository field.npm WARN ubuntu No README datanpm WARN ubuntu No license field.+ faker@4.1.0updated 1 package and audited 5 packages in 0.959sfound 0 vulnerabilitiesI am using Cloud9 and when it is done installing or whatever it is doing I can't find the node_modules folder, it is really confusing for me and I can't seem to make it work. Please let me know if you know what causes this or how to fix it, Please guys.P.S: I tried installing a couple of packages got the same problem.​Thank you very much

Submitted May 29, 2019 at 06:22PM by Taro_Naza

Downloads for a CI auditing tool, weekends are slow

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

Submitted May 29, 2019 at 05:38PM by QuinnTurner

How would you create a publishing platform concept of microservice?

I created a publishing platform using Nodejs, express, mongoose and handlebars. As of now everything is in working as single instance.I'm wondering how an expert would create a publishing platform using microservices?

Submitted May 29, 2019 at 04:19PM by pverma8172

I need a help resolving promise

I am getting output like[ [ Promise { 30 }, Promise { 18 }, Promise { 10 } ],[ Promise { 50 }, Promise { 10 }, Promise { 18 } ],[ Promise { 20 }, Promise { 14 }, Promise { 10 } ] ]​but want it to be like[[30,18,10],[50,10,18]]let destinations = [[{ origin: 19, destination: 11 },{ origin: 11, destination: 7 },{ origin: 7, destination: 3 }],[{ origin: 19, destination: 31 },{ origin: 3, destination: 7 },{ origin: 7, destination: 11 }],[{ origin: 19, destination: 1 },{ origin: 11, destination: 3 },{ origin: 3, destination: 7 }]]let promisesArray = destinations.map(destination => {return (destination.map(obj => {return new Promise((resolve, reject) => {findDifference(obj).then(data => resolve(data))})}))})Promise.all(promisesArray).then(function (results) {console.log(results)}).catch(function (error) {console.log(error)})​function findDifference(obj) {return new Promise((resolve, reject) => {resolve(obj.origin + obj.destination)})}

Submitted May 29, 2019 at 03:11PM by hightek11

How to Create an Authentication Service in 10 minutes

https://medium.com/connect-platform/connect-102-an-authentication-service-402532d3486f

Submitted May 29, 2019 at 11:06AM by lorean_victor

Javascript Promises ES6 Training Tutorial (Under 6 Min)

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

Submitted May 29, 2019 at 11:43AM by rangelstoilov

Call for Speakers - React Advanced London, Oct 25, 2019

https://forms.gle/yiCsoLLwSKnTmeVn7

Submitted May 29, 2019 at 11:54AM by FrontendNation

create-node-addon: A minimal utility CLI tool for bootstrapping C/C++ Node Addons

https://github.com/undefinedbuddy/create-node-addon

Submitted May 29, 2019 at 09:42AM by saddam96

How to use Machine Learning to fix tests

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

Submitted May 29, 2019 at 09:48AM by wernerklaus

Introducing FunctionScript: Turn JavaScript (Node.js) functions into typed HTTP APIs

https://github.com/FunctionScript/FunctionScript

Submitted May 29, 2019 at 08:05AM by keithwhor

Tuesday 28 May 2019

Secure Public API's in node js which cannot be accessible from other sources like postman

I am working on a project in which anyone come to my website and submit a form after filling some information. I want to secure my api so that nobody hit the same api from postman as we don't have any authentication here such as username and password. Thanks in advance!

Submitted May 29, 2019 at 06:30AM by Algoder

GitHub - FullHuman/tosin: Initialize a npm package with everything included, from CI to documentation website

https://github.com/FullHuman/tosin

Submitted May 29, 2019 at 06:40AM by Ffloriel

Safe to split Backend & Payment service?

I'm building an E-Commerce website. I'll have 2 access methods. I'll be implementing REST api to be used in angular/react and backend will also use handlebars if client doesn't want to split frontend and backend.So when it came to payment part. I was think should I split payment and backend by create another node app which will accept the payment API from backend and will process the payment then return the callback URL to backend.Will it be safe and does it comes under microservice architecture?

Submitted May 29, 2019 at 04:32AM by pverma8172

Node v10.16.0 (LTS)

https://nodejs.org/en/blog/release/v10.16.0/

Submitted May 29, 2019 at 01:49AM by dwaxe

Transaction handling

I need to see if I'm missing something when it comes to Node and PG transactions. We're using postgresql, node-postgres.com. We are not using transactions. Instead the connection pool is a global variable in the data access layer. If any DB component needs to connect to the DB, it just calls db.query (which wraps getting a connection and executes the query for the team). No connections are shared.I want to introduce transactions to most of the code. To this end, I believe that the transaction object has to be passed through the layers of the application in some manner. It could be implicit by using dependency injection and constructors, or explicit like Go's context.When I went with the Go style where every function (ours are mostly static methods right now) gets a transaction, my team says that it's too complex. They think there is a better way.I've been wracking my brain, but I don't see how I can propagate a transaction through the stack without manually handing it down. Is there a way to put it in a global variable like we did with out connection pool?

Submitted May 28, 2019 at 08:57PM by HeavilyFocused

Searchable Encryption for Node.js projects (ciphersweet-js)

https://github.com/paragonie/ciphersweet-js

Submitted May 28, 2019 at 08:51PM by sarciszewski

How do I get full html of infinte scroll webiste using "request" ?

No text found

Submitted May 28, 2019 at 08:06PM by wrongtake

Socket IO organization

I have an API listening on port 3000 and I am working with Socket IO. Now, it is better create a new server for each Socket IO service or create a new route in the API and put there all my Socket IO related stuff?

Submitted May 28, 2019 at 06:55PM by ForeignEnginer

To-do web application with user login and registration.

I recently built a fully-fledged dynamic to-do web application incorporating a user registration and login system that makes it easy to keep track of all your tasks in one place.You can check it out here - https://github.com/alexnjoroge/todo-list

Submitted May 28, 2019 at 07:17PM by lanytumble

AWS Fargate: The Future of Serverless Containers (x-post /r/aws)

https://www.reddit.com/r/aws/comments/bu1tm8/aws_fargate_the_future_of_serverless_containers/

Submitted May 28, 2019 at 05:07PM by nshapira

Equivilant to PyAutoGui in node.js?

I want to do a project where my programm looks for a "picture" on the screen and then act based on where it is found and what other pictures are also found. I've done this in Python using PyAutoGui, but I want to do more or less the same thing in node. Is there a package that lets me do this?

Submitted May 28, 2019 at 05:26PM by That-Redditor

little help i have a error says Photo is not defined

router.post("/images/add", async (req, res) => {const result = await cloudinary.v2.uploader.upload(req.file.path);const newPhoto = new Photo({imageUrl: result.url,public_id: result.public_id});await newPhoto.save().then(newPhoto => {res.status(200).json('added successfully')}).catch(err => {res.status(400).json.send('adding new photo failed')})await fs.unlink(req.file.path);})​backend code error......mongodb connection is working(node:14020) UnhandledPromiseRejectionWarning: ReferenceError: Photo is not definedat router.post (C:\Users\Dante Delgadillo\Desktop\upload images\backend\routes\index.js:21:22)at process._tickCallback (internal/process/next_tick.js:68:7)(node:14020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). (rejection id: 1)(node:14020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Submitted May 28, 2019 at 04:35PM by ddante93

Stack Overflow Developer Survey 2019 - JavaScript Ecosystem Rules!

JavaScript is the Most Popular Programming Language for the Seventh Year in a Row!JavaScript is the 2nd Most Wanted; TypeScript is the 4th Most Wanted and 3rd Most Loved LanguageNode.js is the Most Used and React Native is the 6th Most Used technologyNode.js is the Most Wanted and React Native is the 3rd Most Wanted technologyMost Used, Loved and Wanted JavaScript Web Frameworks:React.js (2nd Most Used, 1st Most Wanted, 1st Most Loved)Vue.js (7th Most Used, 2nd Most Wanted, 2nd Most Loved)Express (5th Most Used, 6th Most Wanted, 3rd Most Loved)Angular / Angular.js (3rd Most Used, 3rd Most Wanted, 9th Most Loved)jQuery (1st Most Used, 5th Most Wanted, 11th Most Loved)MongoDB is the Most Wanted, 5th Most Used and Loved DatabaseVisual Studio Code is the Most Popular Development Environment​Source - https://insights.stackoverflow.com/survey/2019/

Submitted May 28, 2019 at 04:45PM by Musfiq-Fahad-Amin

The 80/20 Guide to JSON.stringify in JavaScript

http://thecodebarbarian.com/the-80-20-guide-to-json-stringify-in-javascript.html

Submitted May 28, 2019 at 04:57PM by code_barbarian

Webpack 4 + Mini-CSS-Extract-Plugin rendering undefined CSS classes

I needed to reach out to somebody because I'm struggling here. Major apologies if this seems stupid, because I'm a Node noob.I inherited a project that was using webpack 3 and extract-text-webpack-plugin, and I had to upgrade to webpack 4. Upon upgrading, removing the old webpack.config, and re-ejecting the project using react-scripts. The problem is that somehow this has broken the CSS for the project. For instance I have an import statement for a component (the folder contains the JS file and the CSS file):import classes from './Masthead.css'; Then the style class from the CSS import is used in the JS:const masthead = (props) => { return (
props.history.push('/')}> (note that is just a snippet of the full code, this is just an illustration)When rendered, I'm expecting something like this:
Instead I'm getting:
I'd be happy to post some details about what is in my webpack.config, but it seems like it's all wired up correctly for the most part. Could I be missing anything else?Edit: here is my webpack.config.js.

Submitted May 28, 2019 at 04:59PM by ziptnf

Generate and parse MongoDB UUIDs with Node.js

https://github.com/cdimascio/uuid-mongodb

Submitted May 28, 2019 at 03:59PM by coracarm

Sequelize get count of association based on where condition

I have a table Patient which is associated to another table Visits. A Patient can have many visits and one Visit is associated with one Patient.Visit is connected to a Patient via patient_uuid foreign key​Visit.belongsTo(Patient, {as: 'patient',foreignKey: 'patient_uuid'});​Patient.hasMany(Visit, {foreignKey: 'patient_uuid'});​Visit also has a visit_status field ('SCHEDULED', 'COMPLETED', 'CANCELLED').When I get list of all Patients I want to show visit count where the status is COMPLETED.I tried doing this:​Patient.findAll({attributes: ['uuid', 'first_name', 'last_name', 'mobile_phone',[Sequelize.fn("COUNT", Sequelize.col("visits.uuid")), "visitCount"]],include: [{model: Visit,where: {visit_status: 'COMPLETED'},attributes: []}],order: [['first_name', 'ASC']]});I do get patients list and it has the visitCount values, however the query completely skips those patients where the visit status is not completed.I would like to get all the patients with visitCount and for those where the status is not COMPLETED I would like to see 0. But it drops those patient records from the result.Is there any way to include the patient records where the visitCount is 0?

Submitted May 28, 2019 at 04:10PM by codeinprogress

GraphQL Predictions 2019+

https://blog.graphqleditor.com/graphql-predictions-2019+/

Submitted May 28, 2019 at 03:12PM by rob_mat

An overview of NestJS, TypeOrm and TypeScript: Release your first application in less than 30 minutes

https://blog.theodo.com/2019/05/an-overview-of-nestjs-typeorm-release-your-first-application-in-less-than-30-minutes/

Submitted May 28, 2019 at 02:53PM by quentinso

Top 9 JavaScript Snippet Libraries

https://blog.codota.com/top-9-javascript-snippet-libraries/

Submitted May 28, 2019 at 02:57PM by Oles_Mironov_Mironov

Fullstack React GraphQL template

https://blog.graphqleditor.com/graphql-react-template/

Submitted May 28, 2019 at 02:14PM by oczekkk

Error handling with Async/Await in JS

https://medium.com/p/26c3f20bc06a

Submitted May 28, 2019 at 12:31PM by jsloverr

Javascript get unique items from array

https://learnersbucket.com/examples/array/javascript-get-unique-items-from-array/

Submitted May 28, 2019 at 11:15AM by know_prashant

Knex: modifying a column

Hi all,​A question regarding Knex...If I have this in a migration file:table.timestamps();and would like to modify to this:table.timestamps(true,true);or this:table.dateTime("post_date");and would like to modify to this:table.dateTime("post_date", { precision: 6 }).defaultTo(knex.fn.now(6));how I'm supposed to proceed?​Should I create a new migration? With what content?P.S.I'm using SQLite/PostgreSQL.

Submitted May 28, 2019 at 11:22AM by reditoro

Deleting key-value pair from an object in Express PUT route

Hello everyone,​So I have the following Express PUT route to save some data to the database:router.put( '/:id', (req, res) => { Task.findByIdAndUpdate(req.params.id, req.body.task, (err, updatedTask) => { if (err) { req.flash('error', 'Task not found'); res.redirect('/tasks'); console.log(err); } else { if (req.body.task.enrolledStaff) req.flash('success', 'Task updated'); res.redirect('/tasks'); } else { delete updatedTask.enrolledStaff; updatedTask.save(); } } }); } ) The condition is that if the request body doesn't contain enrolledStaff key, then delete this value from the db collection. The delete operator doesn't seem to work, however if I set the length of the enrolledStaff array to 0 – it works just fine (but this is not what I want to do).What am I doing wrong here?

Submitted May 28, 2019 at 09:34AM by marcusique

Monday 27 May 2019

What error types I should throw in GraphQL Scalar Types?

https://stackoverflow.com/questions/56334924/should-i-throw-generic-error-in-graphql-scalar

Submitted May 28, 2019 at 05:34AM by trmaphi

Event loop related question, I am confused.

I've just studied Node.js event loop and I have a question:​While making API's in express, consider this snippet:​​try { const result = await ColorTrends.findAll(); return res.status(200).json({ success: true, data: result }); } catch (err) { return res.status(500).json({ success: false, errors: err }); } ​I suppose that behind the scenes the event loop being non blocking, it should execute the return res.status(200).json({success:true....}) and would return the response later on. But this does not happen, it waits for the promise to resolve and then returns, why is this so, shouldn't the callback be pushed to event queue?

Submitted May 28, 2019 at 02:45AM by MuhammadHasham

Anyone interested in buying a SAAS starter project for nodeJS ?

Anyone interested in buying a SAAS starter project for nodeJS ?

Submitted May 28, 2019 at 12:30AM by irishgeoffrey

looking for a guide on how to enable HTTPS for a node app running on aws ec2 instance?

No text found

Submitted May 28, 2019 at 01:02AM by eid-a

Question: How do I get the console messages of a website using puppeteer?

I've searched this all over the internet but couldn't come across any way to do so. Could use some help here!

Submitted May 27, 2019 at 11:53PM by nikopotato

What makes authentication so hard?

(Not really a nice js specific question)Authentication seems quite easy to me, literally every online guide says to use bcrypt or some other NPM hashing library to store passwords, taking only a few lines of code.My question is if it’s so easy to hash and compare passwords, when using one of these NPM libraries, what makes authentication so hard?It seems like quite a simple process but i know I’m missing a part of the picture because most backend developers I’ve spoken to say authentication is one of the hardest things to implement correctly but I just can’t get it.

Submitted May 27, 2019 at 11:13PM by jesster2k10

Can someone answer this PUG/JADE related question? Have been banging my head for 2 days.

https://stackoverflow.com/questions/56332639/why-the-li-tag-not-getting-the-value-of-loop-variable

Submitted May 27, 2019 at 11:31PM by sami3ullah

Major updates to OvernightJS. OvernightJS/core now supports child controllers, all Express routes, and adding options to controllers. OvernightJS/logger now can be used statically or as an instance:

https://github.com/seanpmaxwell/overnight/#readme

Submitted May 27, 2019 at 09:19PM by TheWebDever

Doing anything else than webdev?

I'm fairly new to node.js programming but the general impression I've gotten is that it is really only meant for web dev.I've been thinking about coding simple bots for old classic games in node to get comfortable with the idea of asynchronous executing and such. My question is: Would you recommend doing anything else than web dev using node.js?

Submitted May 27, 2019 at 08:17PM by That-Redditor

Microservice Architecture with PM2 Deploy

https://medium.com/@imixtron/microservice-architecture-with-pm2-deploy-4d5f2245f011

Submitted May 27, 2019 at 06:01PM by imixtron

Feedback on Docker Express Boilerplate API Repo.

Hey guys i wanted to share this code, to see if Docker works on your end. If not, please let me know. Thanks.https://github.com/EliHood/es6express-knex-boilerplate-apiI'm quite new to docker, and its been challenging to wrap my head around.

Submitted May 27, 2019 at 06:32PM by EliHood

How do I learn how to test properly?

I have a medium-sized node application written with express. Everything works correctly and now I wanted to learn how to write tests but I'm clueless. I imagined it would be easier than it is. I don't even know where to start, I just sit in front of my editor and do nothing since like 3 days. Can anyone point me in the right direction? My app has authentication system, comments/posts system etc. I use PostgreSQL with Knexjs

Submitted May 27, 2019 at 05:59PM by IdleSolution

`to-query` – Getting query parameters from any URL, with capabilities

https://www.npmjs.com/package/to-query

Submitted May 27, 2019 at 04:10PM by kikobeats

Simple speed-typing game that runs in a browser

I recently built a simple and fully responsive speed-typing game to put y our typing skills to the test.You can check it out here https://github.com/alexnjoroge/typeseeker

Submitted May 27, 2019 at 03:39PM by lankycommoner

Web Application Firewall for nodeJS

What WAF do you guys use to monitor your nodeJs web app? Currently evaluating Sucuri but wanted to see if there were any others I should consider?

Submitted May 27, 2019 at 03:41PM by OzzieInTx

To-do web application with user login and signup

I recently built a simple, dynamic to-do list web application with node.js as the backend language that makes it easy to keep track of your everyday tasks.You can check it out here https://github.com/alexnjoroge/todo-list

Submitted May 27, 2019 at 03:29PM by lankycommoner

NodeJs with(out) Express ~ Part 1

https://smellycode.com/node-express-part1/

Submitted May 27, 2019 at 02:19PM by smellycode

API monitoring in nodejs

Hi there,I work at a ecommerce based startup and we have broken down the app into 6 (or maybe more) services on kubernetes.Each service may have several APIs.I want to add performance monitoring for our APIs and I'm looking for recommendations for the same.I was suggested by my manger to have a look at "appmetrics" as a starting point. I also came across "swagger" a while back but not sure if it's as good as appmetrics.I want to know what all things should be monitored and what other open-source tools are available for performance monitoring .

Submitted May 27, 2019 at 10:28AM by casual_sinister

Learn the node headless CMS (Strapi) in 12 minutes

https://www.youtube.com/watch?v=hisau__LM-o

Submitted May 27, 2019 at 10:42AM by EatAllTheGame

How do I create a desktop application with web interface?

Hey all,​I'm looking to learn NodeJS and I'm thinking about a new project to create.​I was wondering what frameworks are used to create a desktop application with a web interface ( hosted local? )​For example: If I had a node application that can be used as a file explorer, how do I send the directory information to my website and send information back to the node application? Are websockets used for this? or do I set up an API and make requests every time I need to do something?

Submitted May 27, 2019 at 10:49AM by MoistQuacker

Sunday 26 May 2019

Javascript array: Complete reference

https://learnersbucket.com/tutorials/array/javascript-array-complete-reference/

Submitted May 27, 2019 at 07:22AM by know_prashant

what module do you recommend for building a simple REST api with an apiKey passed in the url param?

I am going crazy with all these different options. I've tried nest.js but it seems way too complicated for what I need:https://myapi.com/key/vjasdfa0s8y/calculateEndpointMy users will sign up and receive an API key they need to pass in the URI parameter to access this endpoint.What module lets me do this easily?I'm just really exhausted, I've been trying out different frameworks all day but just can't seem to find something that is light on config and dead simple.

Submitted May 27, 2019 at 04:31AM by canadasaram

App Config: (yet another) simple solution for configuration with schema validation, generated types and many file formats

https://github.com/servall/app-config

Submitted May 27, 2019 at 12:11AM by qwertydirty

Footing: A foundation for developing APIs with Node.js and Express.

https://github.com/arviteri/footing

Submitted May 27, 2019 at 01:14AM by apptryer

Download and serve images server with queue

I have an application where I show some images parsed from some sites, for now I store the images locally on the same server where I have the database and I store just the relative path like /images/somerandomimagename.jpg. The app will grow fast and I want to decouple the images from the main server.So what I want to make is a server where I have a queue of images to download and serve(basically put 100 links and the server downloads one pictures per second), something like if I send:[www.somesite1.com/image1.jpg, www.somesite2.com/image1.jpg, www.somesite3.org/image2.jpg\]to my server api then I will be able to download/access them from: www.myserver.com/somesite1.com/image1.jpgwww.myserver.com/somesite2.com/image1.jpgwww.myserver.com/somesite.org/image2.jpgMy idea is to use NodeJS in order to make this, can you suggest me some tutorials to start with ?

Submitted May 27, 2019 at 01:08AM by dica266

I want to learn Node.js in depth. Like so that I can be a really competent developer of it.

Are there any resources that can help

Submitted May 26, 2019 at 11:47PM by MuhammadHasham

JavaScript Try Catch & Error Handling ES6 Tutorial (2019)

https://www.youtube.com/attribution_link?a=u7KRTg9UsYE&u=%2Fwatch%3Fv%3Dye-aIwGJKNg%26feature%3Dshare

Submitted May 26, 2019 at 10:51PM by rangelstoilov

To-do web application with user login and signup

I recently built a simple, dynamic to-do list web application with node.js as the backend language that makes it easy to keep track of your everyday tasks.You can check it out here https://github.com/alexnjoroge/todo-list

Submitted May 26, 2019 at 10:09PM by lankycommoner

[linking_electronJS-with_nodeJS]

I want to build a windows executable application with electronJS. How to include node.js or server side working in electronJS file? I want to design a basic login page with all the required logic including backend authentication from the server. I have separately designed an electron app which displays sytem information and a separate node.js basic functioning website. How to link both? I hope my question is clear.

Submitted May 26, 2019 at 10:12PM by iamqbm

Verdaccio 4 released

https://verdaccio.org/blog/2019/05/19/15-verdaccio-4-release.html

Submitted May 26, 2019 at 08:31PM by Arkiteck

Requesting infinite scrolling website

I have to scrap a website with infinite scrolling. I used 'request' and 'cheerio' to return the html of site, as expected it did not return the complete html.So, how do I get the complete html ? Is it even possible with cheerio ?request('https://www.website.com', (error, response, html) => { if (!error && response.statusCode == 200) { console.log(html); } });

Submitted May 26, 2019 at 08:17PM by wrongtake

GitHub Sponsors post-install script

https://github.com/Ffloriel/github-sponsors

Submitted May 26, 2019 at 06:39PM by Ffloriel

Intercept request or console output on a public server?

Hello, I use a website (Streamlabs) that allows people to send a Youtube video played on a web page embedding the Youtube video player (https://www.streamlabs.com/widgets/media/v1/my-secret-key).​With Node, I'd like to save all videos send to watch them later, but it looks like the Streamlabs API don't provide this information yet. Is it possible to do it myself considering when I open the devtools:- In the network tab, I see the GET request to Youtube when the video is played (the video ID is in the request URL),- In the console tab, I see an output containing all necessary data.- They are using the Youtube Iframe API, not the

How to upload Image to Cloudinary Node JS | Cloudinary image upload node...

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

Submitted May 26, 2019 at 02:48PM by renurawat

NodeJS server question

Hi! I want to make a multiplayer card game on Android and my server is on my laptop that's connected on a Wi-Fi router. The problem is that I don't want to hard code the server IP into my Java code, I want to automatically identify it on my Wi-Fi router. How should I approach this?

Submitted May 26, 2019 at 02:51PM by Skorpyon42

When a Filter Goes Wrong: Adventures in Async/Await

https://www.jimhribar.com/adventures-in-async-await/

Submitted May 26, 2019 at 03:09PM by haxorjim

Doing Heapdumps safely on Production servers?

Let's say we have a node.js running in production server that grew from 100mb to 1GB, and we want to figure out if there's any leak. Is there a way to figure out memory leaks without having signficant performance impact on server? The way I would do it on a development server is by taking heapsnapshots on the process and doing a comparison analysis between profiles. The problem doing this in production is that it would actually making the node.js process unresponsive for several seconds (especially if the memory is large). Apparently, node.js fork doesnt support shared-memory as well, so one can't simply fork for an existing process, and do a heapdump analysis there.​How do you guys hunt node.js memory leaks safely in production servers? Do you just use the chrome console, and inspect program state manually? Or do you guys just accept the fact the server would just have to be unresponsive for a while and heapsnapshots should be taken sparingly.

Submitted May 26, 2019 at 02:17PM by simpleyuji

How do you style the emails you send with node?

What is your favorite approach?

Submitted May 26, 2019 at 07:49AM by Kr7731

Node server, where to store JWT token that doesn't expire?

My node server needs to perform an API call every minute, for that to work I'm thinking of using JWT (is that a good idea for a server?) to authenticate with the API, now in a Client application I would use localStorage to store the token, but where and how do I store a token on my server?

Submitted May 26, 2019 at 08:26AM by pilfton

Saturday 25 May 2019

Are Callbacks necessary when writing modular code?

I'm new to Node. I've been working on a small project and recently found my main js file is getting cluttered so I wanted to structure it in a way where it can continue to grow without becoming impossible to understand.So I separated related functions into different files and simply exported the function that gets called, but now that function can't call the main event function as it's in a different file. Is a callback my only option? I've been trying to avoid them as much as possible to avoid confusion later on in development.

Submitted May 26, 2019 at 02:21AM by DangerDeloach

File conversion using node

Can someone kindly guide me that is there any way to convert .docx file to .PDF by using node ?I have done in PHP but not sure about node Thank you

Submitted May 26, 2019 at 02:23AM by Mr_Developer01

NodeJS JWT Authentication Tutorial | TutorialEdge.net

https://tutorialedge.net/nodejs/nodejs-jwt-authentication-tutorial/

Submitted May 25, 2019 at 11:14PM by elliotforbes

How to perform calculations in Node and making some data available easily around the app?

I am developing an app to learn MERN stack, it basically allows a user to login via facebook oauth using passport.js and then show basic stats that are available through the FB Graph API.I have successfully implemented the auth flow in Express, storing the user in my MongoDB if a new user logs in. Thing is after this I do not understand how to further structure my app, I am trying to use the MVC pattern or MVC without the V I guess since React is on the front-end.I need to perform some calculations to aggregate data that is coming in from the Graph API regarding different posts of the user. I have read that you do not write synchronous code in Node for performance reasons, so should I be using Task queues (e.g. Kue) to handle these calculations so that my application can be easily scaled or is there some other way?Secondly, FB Graph API basically requires the access token to be included in every request that is made. I have got the basic user identification metadata in my passport.use function but I do not understand how to pass this access token around my app. I need to write different controllers that can access different parts of the Graph API so is there a good way in which I can make this access token available wherever I need to make a request to FB?

Submitted May 25, 2019 at 10:16PM by captainforg

OCR plugin to convert PDF document?

Looking for a OCR plugin for node that can convert an entire PDF document (not just a single image) to readable text in a PDF format or word.

Submitted May 25, 2019 at 05:56PM by codeunshackled

A WebAssembly module to convert xml to json

https://github.com/tuananh/camaro/tree/develop

Submitted May 25, 2019 at 04:53PM by tuananh_org

I'm a beginner web developer. Can you help me choose on what should i continue to learn, is it REST or GraphQL ???

I've tried Express JS but there is a lot of things to do to make it secure, fast and real time. I've also tried GraphQL with Prisma and React and it is okay for me but I can't find a Framework of GraphQL so that I can focus on my business logic... Your answer will help me decide on what should I continue to learn, is it REST (Express.JS or other frameworks like feathers.JS or sails.JS) or GraphQL ???

Submitted May 25, 2019 at 04:49PM by Ayeng2x

Help: Managing users expectations for open-source projects

I'm the author and maintainer of sync-dotenv and I could really use some help 🙏​Context: sync-dotenv is a CLI tool that automates the process of keeping your .env file in sync with .env.examplesync-dotenv will attempt to sync .env with .env.example (default) when no arg is provided. Failure to find either of these files will cause the sync to fail.​I got a request from a user wanting the sample file (.env.example) to be created if not already exist. The request sounds reasonable, but I really don't know how other users will feel about it.​Question: Do you think it's better to create the sample file if not already exist? If not, how do you politely tell the user that their request will not be fulfilled?​P.S: I'm new to maintaining open-source project.

Submitted May 25, 2019 at 04:02PM by codeshifu

How can i execute JS script on NodeJS server?

I would like to run script and return result. In general script i send to Node is about doing some maths:original script looks like: (on site)​Im already sending it to my Node servers and data looks like:{ "script1": "z6a1=9701;u1z6=1943;c3d4=1927;i9v2=8796;b2t0=5171;s9q7=6136;h8k1=5806;j0h8=4406;r8j0=5339;l2l2=8123;n4h8q7=0z6a1;q7i9w3=1u1z6;u1n4l2=2c3d4;x4y5s9=3i9v2;k1c3x4=4b2t0;g7r8b2=5s9q7;y5a1e5=6h8k1;z6t0r8=7j0h8;w3m3o5=8r8j0;a1f6n4=9l2l2;", "script2": "document.write(":<\/font>"+(q7i9w3u1z6)+(n4h8q7z6a1)+(w3m3o5r8j0)+(n4h8q7z6a1))" }

Submitted May 25, 2019 at 03:45PM by Skeldar

Node.js starter CLI

Hello everyone,​Last week i made simple CLI in Node.Js for my projects in Wordpress. I haven't used any dependencies, just the native file system.I develop custom Wordpress themes and i found it rather annoying when i have to create new php and scss components and import them into the files. Almost every section of any page is one component, so every time i wanted to make it I had to make new php file, link it into the page, create new scss component and import it into the main.scss file.So i made my CLI to do this job for me, so i can speed up my workflow a little bit.https://github.com/moonbyt3/starterCLII would appriciate if you could give me some suggestions about my code. I just started with Node.Js its' pretty fun to work with. I hope there are some experienced developers that could point me in the right direction.All the best :)

Submitted May 25, 2019 at 03:14PM by moonbyt3

pm2 caused thousands of CI builds to fail because of an "optionalDependency" on a package called gkt which is requested as a tarball from a server that was returning 503. That package consists of one file which contains this: console.log('Smarty Smart Smarter');

https://mobile.twitter.com/lukejacksonn/status/1131506699356037121

Submitted May 25, 2019 at 02:29PM by goto-reddit

Had an Interview in Node... Am I Mistaken?

I just had an interview for Node dev position, I have been working in it for 2 years.One of the questions I received was regarding Node and multithreading. I know the interviewer admittedly was more of a C#/ .NET dev so I wasn't sure if he thought threading had to be manually managed by the developer in Node like it does for C#. I answered that Node handles it automatically (or something like that). I don't think he liked this answer and laterally moved to something like "so what if there is multiple concurrent requests?" I said something like Node is non-blocking and unless you are writing async code, race conditions and data integrity management is handled pretty well by Node.​I answered humbly because to be honest im not entirely sure how Node works behind the scenes. I just know I have made Apps where threading and data integrity never came into play the sessions always matched even in concurrent requests.​Am I wrong? What do you suppose my interviewer was looking for?​EDIT: I gave a quick rundown of my answer they were actually more detailed, pretty certain interviewer wasn't looking for more detail. He seemed like he thought there must be something done about threading/thread-safe/ data-integrity in Node, manually.

Submitted May 25, 2019 at 01:19PM by Macdaddy6969

Nodejs module request delete the cookie at the end of the post call

Is there a possibility to delete the cookie at the end of the post call?I set the jar: true, but I would like to end the res.send (..) before deleting the cookie.

Submitted May 25, 2019 at 11:14AM by kejank

Friday 24 May 2019

The 80/20 Guide to Promises in Node.js

http://thecodebarbarian.com/the-80-20-guide-to-promises-in-node-js.html

Submitted May 25, 2019 at 07:30AM by harlampi

Need help building a React/Mongo/Strapi(Node framework) appointment scheduler

Trying to figure out how I should go about this.. the nice thing about Strapi is that it cuts out a lot of simple routes like delete and post routes but trying to modify it gets a bit pain in the ass.. that said.. anyone know how to do this? I’m trying to figure it out. I had a few thought process approaches but feel like they wouldn’t be too efficient with querying the DB over and over. Any advice/ideas?

Submitted May 25, 2019 at 04:54AM by brooklynturk

NVM List; What am I looking at? I was looking around and....

So I was googling around and I have bits and pieces of the puzzle, but I need a baseline understanding so I can go forward understanding what the heck I'm looking at in my terminal. Please can you list out what it means line by line? This is a print out from nvm list on my macos.v8.13.0 v8.16.0 v10.15.1 v10.15.3 -> v12.3.1 default -> v8.13.0 node -> stable (-> v12.3.1) (default) stable -> 12.3 (-> v12.3.1) (default) iojs -> N/A (default) unstable -> N/A (default) lts/* -> lts/dubnium (-> v10.15.3) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.16.0 lts/dubnium -> v10.15.3Like that first arrow. Why is there a pointer to v12.3.1? I am using 8.13.0 by default and it says that, but there are arrows everywhere and yet in the first list there are no arrows; this is just an example of what I don't understand.

Submitted May 24, 2019 at 09:17PM by misterhtmlcss

How do you test a function which is composed of other functions and relies on a db connection?

I have written this function:async function ValidateUserExists(username, email){ if(!username || !email) throw new Error('Invalid number of args passed. Please pass username and email'); let taken_valid_username = null; let taken_valid_email = null; if(username){ taken_valid_username = await UsernameExists(username); } if(email){ taken_valid_email = await EmailExists(email); } if(taken_valid_username) return taken_valid_username; if(taken_valid_email) return taken_valid_email; return null; } I have integration tests that prove UsernameExists() and EmailExists() work correctly.It's main purpose is to see if a user already exists in the database. I can't just mock something here because both UsernameExists() and EmailExists() are designed to reach into the database and see if a user actually does exist.​I have a lot of functions like this as I'm building an app whose main purpose is to manipulate a database, meaning I have A LOT of integration testing happening.​So far the test I've written looks like this:it('should see if a user already exists on an existent email', async ()=>{ const test = await CreateDummyUser(); const user = await ValidateUserExists(test.username, test.email); //expect user properties here await DestroyDummyUser(test); }) ​From everything I've read unit testing should be much more prevalent than integration tests so I'm convinced I'm doing something incorrectly. BUT, a huge part of my business logic is doing things based on data from the database.I know this is a huge topic. Any recommendations on books or blogs or videos would be really helpful.

Submitted May 24, 2019 at 07:42PM by blindly_running

AWS Lambda Layers: Getting Started Guide (x-post /r/aws)

https://www.reddit.com/r/aws/comments/bsjqzo/aws_lambda_layers_getting_started_guide/

Submitted May 24, 2019 at 06:33PM by nshapira

Develop NPM modules with ease by symlinking

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

Submitted May 24, 2019 at 06:10PM by ybrodey

Node js json object getting undefined on api call when accessing values within object

So i am doing a nested api call using axios and I am getting a nested json object returned. Every time i try to access values within the nested json object I keep getting undefined heres an exampleapp.get('example/url){try{axios.get('api/url',{auth:{username: 'user",password:"password"},headers:{'Content-type':'application/json; charset=utf-8'}}).then(function(response){var examplePasrse = response.data.resultconsole.log(exampleParse.user_name)}// end of try}// end of get api callAlso i do have body parser enabled in my app and the object returned if just printing data"result": user_name

Submitted May 24, 2019 at 05:57PM by codinginsomnia

Webinar: component testing in Node.js

https://zoom.us/webinar/register/7815587114655/WN_S_zAgALHRhalQGTOmHIFqg

Submitted May 24, 2019 at 04:26PM by yonatannn

Question - fs.readdir() leaves files open - how can I close them?

When looping through some directories using fs.readdir() at some point I get the following error message:Error: EMFILE: too many open files, open 'myfile.txt'Emitted 'error' event at:at lazyFs.open (internal/fs/streams.js:115:12)at FSReqWrap.args [as oncomplete] (fs.js:140:20)I assume this is because I do not do fs.close(fd) on these files, since I do not get the option with fs.readdir() to set a file descriptor for every file I loop through in a directory.How can I close the files I have already looped through? I really can't afford to manually open all files one by one using fs.open() .Thanks for any tips or hints in the right direction. I use fs.stat() and lineReader from the linereader interface to read the first line of each file, because I only need to check the content of the first line.

Submitted May 24, 2019 at 03:34PM by Exploree1

Express Application - 502's no errors

We've got an issue whereby our MEAN app (multi-AZ, hosted in AWS) seems to be emitting 502 errors intermittently and seemingly on random routes with zero delay (immediately rejected by the ALB / node servers). It's such a strange behaviour and no logs are showing errors that I thought I'd tap on you guys to give some hints about what might cause insta-rejected requests when hundreds of others over the same few minutes can be seemingly fine alongside. Express is running at 4.16.4 if that helps, and using the blocked-at module we can see some intermittent thread blocks for up to 1s very occasionally around large mongoose operations, but nothing that appears to coincide with the 502's we experience.I've sieged my local version but never seem to be able to recreate the 502's.Any hints / tips / debugging procedures would be highly appreciated.

Submitted May 24, 2019 at 03:59PM by inYOUReye

I created a micro server to host my bots in just $40

https://medium.com/@amritpandey/i-made-a-micro-server-to-host-my-bots-935eb6c9b04c

Submitted May 24, 2019 at 01:47PM by hardasspunk

How Endtest Is Using Machine Learning To Make Your Tests More Stable

https://dev.to/endtest_io/how-endtest-is-using-machine-learning-to-make-your-tests-more-stable-52hn

Submitted May 24, 2019 at 02:59PM by wernerklaus

Question ! Processing more than array of 1 million objects.

Hey everyone ,I want to split an array of 1 million objects into 250 sets. Can anyone help me please ? Actually It's for SMS sending API , they allowing to send 250 SMS per request.

Submitted May 24, 2019 at 12:28PM by MYTHiN07

Build an Interactive Voice Response Menu using Node.js and Express

https://dev.to/nexmo/build-an-interactive-voice-response-menu-using-node-js-and-express-3io8

Submitted May 24, 2019 at 12:07PM by dobkin-1970

HTTP requests Node and React JS

I have a node and react application in which the latter was created with CRA. During development, the react app is usually at port 3001 and the node app is at 3000. Everything works fine since they are running on different processes and on different ports. The problem arises when I deploy it on the cloud. For deployment, I build my react app and once this is done, I put it inside my node server. Since during development, they were on different ports, everything worked fine, but now, since they are both running on the same port, making calls to the backend do not work with the same URL as during development. One way around this, has been to change this URL on the react side with my main public domain, essentially making the calls appear as if they were coming from the outside world, but in reality, they come from within. Im sure there is a cleaner and more proffesional way to go around this no?Thanks!

Submitted May 24, 2019 at 11:19AM by sebasjuan94

[HELP] Authentication between back and front

Hi there! I have an Express Node app (with TypeScript), currently serving with EJS and use passport-local and passport-facebook for authentication.Now I'm writing React app for frontend. But I don't know how to handle authentication between two. Also I've heard a few bad things about JWT.Please donate me some resources to learn about authentication between back and front.

Submitted May 24, 2019 at 08:57AM by xzenuu

Thursday 23 May 2019

How to use environment variables in Node.js

https://itnext.io/how-to-use-environment-variables-in-node-js-cb2ef0e9574a?source=friends_link&sk=d6c9c01ebae2185beefc666485ebfbb0

Submitted May 24, 2019 at 07:23AM by jsloverr

Best way to host several Node Apps? (10+)

Im searching for a hosting solution for several node apps. Right now about 10-15 apps. But they will get more.The easiest solution would be Heroku. But sadly its way to pricey for me. Does somebody know something similar not that costly?Basically i need a Server with all node apps with seperate external domains pointing to each app including ssl.I tried to understand AWS but failed misserably. I think its a bit to complex for me right now.Any ideas? Or is that just utopian thinking :D?​Thanks!

Submitted May 24, 2019 at 01:19AM by DerQualle

A command line application: Scraping dev.to with puppeteer

https://dev.to/damcosset/a-command-line-application-scraping-dev-to-with-puppeteer-149k

Submitted May 23, 2019 at 10:44PM by philnash

Register nodejs to FCM notification

Is it possible to register nodejs to Google FCM to get push notification like any other device ?

Submitted May 23, 2019 at 09:05PM by xyloweb

Node.js Interview Questions

Hello,What do you think about these interview questions:https://www.tecla.io/blog/looking-to-hire-a-node-js-developer-let-us-help-you-prepare-the-interview/Is this a complete interview? What questions would you ask?I would like an employee's and an employer's perspective.Thank you.

Submitted May 23, 2019 at 09:32PM by MMNaveda

The Best Cross-Browser Testing Tools

https://dev.to/razgandeanu/the-best-cross-browser-testing-tools-4hd6

Submitted May 23, 2019 at 08:38PM by wernerklaus

Dockerizing and auto scaling Node.js on Google Cloud

https://medium.com/p/dockerizing-and-autoscaling-node-js-on-google-cloud-ef8db3b99486?source=friends_link&sk=7b27c3d8fb93447f3522f657fd942fce

Submitted May 23, 2019 at 03:57PM by treyhuffine

How to validate checkboxes with a custom message (Using Yup)?

So, I have a checkbox that needs to be checked before the Form gets sent and I wanna display a message in case the user hasn't checked it.So far I have:infoTrue: Yup.boolean() .oneOf([true]) .required('Do you certify that the information you entered is correct?'),I am not sure what I am doing is correct. If I keep the required, it displays a msg from Yup on how it didn't equal true referring to the test of oneOf([true]). If I remove it, Yup just ignores it. If I remove theoneOf([true]) and keep the required, Yup also ignores it.I wanna know how to include a custom message for other failed test cases. For example, I have a datepicker and I told Yup I want it to be between 2 values only. It displays a message but it's Yup's message and I wanna include my own. Here's what I have so far:selectedDate: Yup.date() .min('January 1960') .max('December 1990') .required('Please choose a date between Jan 1960 and Dec 1990'),Thanks in advance.

Submitted May 23, 2019 at 03:07PM by Lojain19

Need help with websocket for bitskins *willing to pay*

https://github.com/Trojan13/NodeBitSkins

Submitted May 23, 2019 at 02:56PM by dontcheatcunt

📦 A Cargo manifest for JavaScripters

https://medium.com/@jesusprubio/a-cargo-manifest-for-javascripters-62ac5ca72b7a

Submitted May 23, 2019 at 12:37PM by jesusprubio

File Uploads with Express

https://masteringjs.io/tutorials/express/file-upload

Submitted May 23, 2019 at 01:06PM by code_barbarian

Bending Jest to Our Will: Restoring Node’s Require Behavior

http://www.petecorey.com/blog/2019/03/25/bending-jest-to-our-will-restoring-nodes-require-behavior/

Submitted May 23, 2019 at 12:23PM by harlampi

I had a strange effect that prevented me from debugging my node applications on windows. Here is how I fixed it.

https://parastudios.de/node-debugging-process-hangs-on-windows-10/

Submitted May 23, 2019 at 12:30PM by chris_engel

How to untar JSON files with plain native Node.js

https://itnext.io/how-to-untar-json-files-with-plain-native-node-js-2536565707c9?source=friends_link&sk=838cfab8173d51c13bbe64b2dbaac59a

Submitted May 23, 2019 at 11:48AM by EvoNext

Looking for Express.js Auto-Generation

Hi guys,I'm basically looking for a toolkit that is able to accept a `yaml`/`json` file like swagger does, and automatically generates all of your routes, puts in the right settings, TypeScript-based (optional), and adds functional tests. Any chance I can find such tool / framework?​Thanks! :)

Submitted May 23, 2019 at 09:07AM by thenoisywatcher

Is there a common/standard structure for node.js app?

Like what should you name your entry js file? How should routes look in files? What should the directory structure look like? Where should you put class files, or singletons.Thanks.

Submitted May 23, 2019 at 08:49AM by WranglesTurtles

Learn how to implement the list data structure in javascript

https://learnersbucket.com/tutorials/data-structures/list-data-structure-in-javascript/

Submitted May 23, 2019 at 07:49AM by know_prashant

How to improve the social network auth process in your node application.

https://medium.com/p/48ac5791131f

Submitted May 23, 2019 at 08:06AM by jsloverr

Elegant Error Handling With The JavaScript "Either" Monad

https://jrsinclair.com/articles/2019/elegant-error-handling-with-the-js-either-monad/

Submitted May 23, 2019 at 07:52AM by fagnerbrack

Wednesday 22 May 2019

Gmail message via the WayScript npm package

https://github.com/wayscript/node-to-gmail-example

Submitted May 22, 2019 at 09:54PM by j_orshman

The 80/20 Guide to Promises in Node.js

http://thecodebarbarian.com/the-80-20-guide-to-promises-in-node-js.html

Submitted May 22, 2019 at 09:13PM by code_barbarian

Need some help with buffers

With normal strings you can use a bunch of different methods for extracting substrings. Can you do something similar and extract a sub buffer of a specified length?

Submitted May 22, 2019 at 09:27PM by SaladTheMediocre

Node v12.3.1 (Current)

https://nodejs.org/en/blog/release/v12.3.1/

Submitted May 22, 2019 at 09:12PM by dwaxe

Getting network error with expressjs on nginx

https://www.reddit.com/r/expressjs/comments/brroqc/getting_network_error_with_expressjs_on_nginx/

Submitted May 22, 2019 at 08:28PM by Android_XIII

Access variables and pass them to third-party libraries

https://medium.com/@kevinkreuzer/flexible-npm-scripts-89b5ec0c5b46

Submitted May 22, 2019 at 04:50PM by kreuzerk

GraphQL Code Inspector

https://blog.graphqleditor.com/graphql-inspector/

Submitted May 22, 2019 at 04:23PM by oczekkk

Best practice for SEO using Node, Express and Pug?

My tech stack is Node, Express and Pug - anyone has some good SEO ideas, methods or recommendations?

Submitted May 22, 2019 at 03:55PM by toomaime

5 Free Ways To Host Your Node.js App In 2019

https://amitbend.com/node.js/2019/05/13/five-free-ways-to-host-your-node-app-2019

Submitted May 22, 2019 at 02:47PM by Fartin_dog

Automating TurboTax Data Entry With Puppeteer

https://www.dannyguo.com/blog/automating-turbotax-data-entry-with-puppeteer/

Submitted May 22, 2019 at 02:36PM by dobkin-1970

I need some help with audio streams

So I'm making a discord bot, and what I want is to play a song, and then at any moment while that song is playing, an audio filter on that song could be changed. Some issues:​I cannot really save anything to disk, everything is done with readable/writable streamsI need to be able to change the ffmpeg settings partway through playback​My idea was to have one ffpmeg process decoding the audio, and then taking the stream output of that and piping each chunk to ffmpeg with options read from a global variable, so if i change the variable, the next chunk gets processed with the new options. Any ideas that could help me with this?

Submitted May 22, 2019 at 01:42PM by thatonegamer999

How to support older versions of Node.

I'm writing a package that uses async/await. Obviously, this gives issues for versions of Node before 7.6.​Is there a safe way I can overload method calls so that they support async/await in later versions of Node, but also support .then callbacks in earlier versions?

Submitted May 22, 2019 at 01:48PM by StaterOfTheObvious

The Best Cross-Browser Testing Tools

https://dev.to/razgandeanu/the-best-cross-browser-testing-tools-4hd6

Submitted May 22, 2019 at 10:43AM by dragnea_presedinte

Node.js 12.3: WebAssembly – Experimental Support for Wasm Modules

https://helpdev.eu/node-js-12-3-webassemblyexperimental-support-for-wasm-modules/

Submitted May 22, 2019 at 11:18AM by helpdeveu

Promise-based circuit breaking for gRPC in Node.js

https://medium.com/@lucavallin/b6ce3f3efa54

Submitted May 22, 2019 at 09:37AM by kiarash-irandoust

How to build a RESTful API in Node, Express & Mongo in 2019 | Tutorial

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

Submitted May 22, 2019 at 10:02AM by Tyler_Potts_

List of ETL Tools for Node.js

You need an ETL (extract, transmit and load) to process your data from its source to your output or data warehouse. And when you build apps with Node.js, you need an ETL that works with it. With any other data work, you might want the flexibility and advantages an ETL built on Node.js offers. The following article lists some of the top open source and paid Node.js ETLs and what they do best: 6 Top-Level ETL Tools For Node.js (and 2 Paid ETLs)EmpujarNextractExtraloadDatapumpsProc ThatNightly ETLEventPanoply

Submitted May 22, 2019 at 08:59AM by thumbsdrivesmecrazy

C9.io will be shutdown and have moved to AWS on June 30. Any alternatives?

https://c9.io/announcement

Submitted May 22, 2019 at 07:42AM by spmaster007

Tuesday 21 May 2019

Why use Nodejs for eCommerce website development?

Have you deployed nodeJS for your eCommerce platform yet? Here is an infographic that talks about how it has benefitted business streamline their eCommerce business. https://shopygen.com/why-to-use-nodejs-for-ecommerce-website-development/

Submitted May 22, 2019 at 06:27AM by Popularstart_Kath

AWS Lambda Node.js 10 Support and Benchmark

https://epsagon.com/blog/aws-lambda-node-js-10-support-and-benchmark/

Submitted May 22, 2019 at 05:43AM by nshapira

Help me to run the code line by line, not async way

I'm having a trouble to run my javascript code line by line. In my route function, I'm using a library to get an info of the given pdf file. Here is my snippet of code.​const res = pdfUtil.info(filePath, function(err, info) { if (err) throw(err); return info }) console.log(res) // prints nothing since the above line runs in async way ​Should I use async/await method to achieve this? Or is there a simpler way?

Submitted May 21, 2019 at 09:25PM by leetae9

Node v12.3.0 (Current)

https://nodejs.org/en/blog/release/v12.3.0/

Submitted May 21, 2019 at 09:12PM by dwaxe

How to test complex middlewares?

I'm completely new to testing back-end.Some of my middleware contains multiple database queries and some are contains a single transaction. How do I test these middleware? Should I put these queries inside a function for easier testing?

Submitted May 21, 2019 at 08:32PM by eggtart_prince

[QUESTION] Recommended way to use router

Any difference betweenrouter.get(); router.post(); - - - - - - - - - app.use(); app.use(); app.set(); androuter .get() .post(); - - - - - - - app .use() .use() .set(); ?Which one is recommended?P. S. I'm building TypeScript API.

Submitted May 21, 2019 at 07:30PM by xzenuu

Test automation analytics using cube.js

https://medium.com/quick-code/test-automation-analytics-using-cube-js-e3ee0fa84981

Submitted May 21, 2019 at 05:52PM by ekbduffy

Best Node.js hosting service for online realtime game?

I'm looking to start hosting my node.js real time game, what service provider should I look into? I'm trying to avoid as much latency, lag, as possible. As well as having good uptime.

Submitted May 21, 2019 at 04:52PM by YYY-2C2D

How to Easily Share Reusable Modules in Node.js- at Scale

https://hackernoon.com/how-to-easily-share-reusable-modules-in-node-js-at-scale-daaab9f0f41d

Submitted May 21, 2019 at 05:01PM by JSislife

How can I detect what is reason of lag?

I created multiplayer game using node, socket.io and node workers. Clients connect to index.js. Workers represent game worlds. My game is only thing i coded in node. Production server is heroku.​When I play game on production server I sometimes experience some lag, sometimes too bad lag. By lag I mean when server don't respect soon enough commands from client or I see in client too big latency. This lag happen probably when more players play game. But I have no idea why and when exactly lag happen. How can I detect when and why happen lag on my production server. I have currently no idea what is happening on server.

Submitted May 21, 2019 at 05:17PM by aqzaqzaqz

How can you require a node package in a seperate .js file ?

For some reason I can't find anything online - I am new to node and electron. I have a main.js file and an init.js file. I want to use require('fs') in init.js. but it fails with require is not defined. It works in main.js but not in init.js.​Any advice ?

Submitted May 21, 2019 at 04:46PM by iwanttodiequick

DAZN is looking for Software Engineer (Node.js)

https://sportekjobs.com/software-engineer-node-js-perform-group

Submitted May 21, 2019 at 03:19PM by toomaime

API testing with Mocha and SuperTest ( on a larger scale )

https://medium.com/@zepfgeorg/node-api-testing-with-mocha-and-supertest-6725bb694731

Submitted May 21, 2019 at 03:46PM by zepfgeorg

GraphQL Server in under 5 min with TS

https://blog.graphqleditor.com/graphql-server-typescript/

Submitted May 21, 2019 at 03:22PM by oczekkk

Learn To Build Form App System With Node JS

https://youtu.be/0YMH1S6nH2E

Submitted May 21, 2019 at 10:30AM by Aisha_b

Building Live Streaming App with Node.js and React

https://quantizd.com/building-live-streaming-app-with-node-js-and-react/

Submitted May 21, 2019 at 10:08AM by harlampi

Why you should not use npm start for applications with child processes

Hey guys, I wrote this post about the famous npm start command and why it should not be used when you are managing child processes in your app. Basically, it all boils down in case of a FATAL failure or the process being killed with SIGINT signal (CTRL+C) which is not being properly passed to child processes when using npm start. This means, when you are listening for the SIGINT signal in your child process in order to enable cleanup/exit gracefully, this signal won't be received in the child process. You can find the article at the Lisk blog.

Submitted May 21, 2019 at 10:13AM by thenoisywatcher

Learn: Creational Patterns in ES6+ using Game of Thrones

https://medium.com/javascript-by-doing/learn-creational-patterns-in-es6-using-game-of-thrones-4444119cda84

Submitted May 21, 2019 at 07:46AM by thecreazy

Algorithm to find the biggest perfect square in an array

https://learnersbucket.com/examples/algorithms/find-the-biggest-perfect-square-in-an-array/

Submitted May 21, 2019 at 08:10AM by know_prashant

Monday 20 May 2019

Node.js file streams explained!

https://areknawo.com/node-js-file-streams-explained/

Submitted May 21, 2019 at 06:55AM by areknawo

A lightweight starting template to use Typescript with ExpressJS with no bells and whistles.

https://github.com/akhilrex/typescript-express-starter-template

Submitted May 21, 2019 at 07:14AM by trexreturns

Is node.js suitable to develop enterprise fintech applications.

Because all I see over the internet is to use .NET or Java. But I love Node.js the community is awesome. Is it a good choice to develop such backend systems with node or should i use java or spring boot?

Submitted May 21, 2019 at 02:12AM by MuhammadHasham

With the advent of deno is there a chance of downfall for Node.js?

No text found

Submitted May 21, 2019 at 02:01AM by MuhammadHasham

How to control and record voice calls with Node.js serverless functions

https://medium.com/@stefanjudis/76b530f44d56

Submitted May 20, 2019 at 09:58PM by kiarash-irandoust

Odd Approach? for Quick Authentication - User Registry API and Passport

https://dev.to/ibmdeveloper/possibly-odd-approach-for-quick-authentication-user-registry-api-passport-js-tutorial-3k02

Submitted May 20, 2019 at 10:08PM by nillicent

n00b help with a loop/filter/log for HTTP requests

Hi all, I'm a node.js noob and I'm trying to write a script that involves looping, filtering and storing information and I'm getting a little stuck, so I thought I would ask for some help here. I have a math/scientific computing background so I'm not totally new to programming, but I'm a (very) junior developer when it comes to JS.Basically, I am doing some data mapping to identify issues in a CRM system. I've been tasked with finding contacts with specific information and filtering the results (I have to find clients who have been labeled 'deceased' and then figure out why users can't filter them.) Originally, I tried just manually making requests in Postman, but that method is a) very tedious and b) it would be good for me to figure out how to do it with a script (and it would make my superiors happy.) Unfortunately, I can't provide too much information on specifics, due to privacy issues. So, my work-around is to base my questions on the Star Wars API, because it will essentially work the same as what I am doing (in fact, I am going to design my script with the SWAPI, then once I have it working, I will put the actual URL and authentication headers in, and run it "for real".) I am using Axios to make GET requests.So basically I have (3) problems I need to tackle.1) I need to filter the responses based on things I can't search with the API; I have to pull the data from the response body. So, using my SWAPI example, I would need to filter characters with eye_color: blue in the response (see below.)2) I need to log the response body (or the ID number, at minimum, so I can retrieve it manually later) if it contains the data I am interested in. To stick with my example, I need to log name: 'Luke Skywalker', since this character contains eye_color: blue in the response.3) Finally, I need to make this process iterative so I can cycle through hundreds of contacts. (I figure I will tackle this last, once I have the filtering and logging worked out in my script.) So, in my SWAPI example, I would need to do something that iterates to get data from different characters, /people/{i} for (i={initialID};i={finalID}; i++) or something like that. It would be cool if I could have the loop stop when I get a null contact, but honestly I could manually find the start and end numbers for the contacts I'm interested in, and just loop for those.My script looks like this right now:var axios = require (\'axios\'); var URL = "https://swapi.co/api"; try{ axios.get(URL+\'/people/1\') .then(function(response) { console.log(response.data); }) } catch (err) { alert(err);}; https://pastebin.com/embed_js/jGaJBeUxI also have a script using async/await that I could use, but I don't think it really matters other than async/await is a little cleaner.And the part of the response I am interested in looks like this:name: \'Luke Skywalker\', height: \'172\', mass: \'77\', hair_color: \'blond\', skin_color: \'fair\', eye_color: \'blue\', birth_year: \'19BBY\', gender: \'male\', https://pastebin.com/embed_js/aXcRikYcIf anyone can offer some help, that would be great. I have been piecing together methods from various places I've found googling, but I'm struggling to make sense of a way to implement all of the above in a way that works for my particular issue. I will edit my post to include other information if I need to. This is my first post here so if I screwed something up, just let me know. Thanks!

Submitted May 20, 2019 at 09:15PM by railnruts

Andrew mead express course or Maximilian schwarzmüller express course

which one is better or is there is any other course that is better than both of them

Submitted May 20, 2019 at 09:20PM by mohammedatef555

WebSockets tutorial: How to go real-time with Node and React

https://blog.logrocket.com/websockets-tutorial-how-to-go-real-time-with-node-and-react-8e4693fbf843

Submitted May 20, 2019 at 09:30PM by humansounding

JSON Formatter, Validator, Editor, Minifier, Parser and Viewer All In One Place

https://json-formatter.utiltree.com/

Submitted May 20, 2019 at 08:52PM by parripandian

⚡️ JavaScript library for parallel code execution 🔀

"Hurried" is a library for parallel (not concurrent!) code execution in JavaScriptHurriedDocs

Submitted May 20, 2019 at 08:17PM by yankouskia

Architecture & Design Of RESTful Service – Node.js API with TDD Tutorial

Let’s walk through the Architecture and Low-Level Design of the RESTful Service. It includes the Layers or Components and Sequence Diagrams of the REST API.https://novicedeveloper.com/architecture-design-rest-api-nodejs-api-tdd/

Submitted May 20, 2019 at 07:39PM by parripandian

Upserting Documents with Mongoose

https://masteringjs.io/tutorials/mongoose/upsert

Submitted May 20, 2019 at 08:07PM by code_barbarian

Fullstack story app using MERN stack and Graphql part 6

https://youtu.be/JZkuJvl5-iM

Submitted May 20, 2019 at 04:55PM by ngovanhuong94

Mongoose: how to use custom options in schemas?

I'm trying to create a Mongoose model, Event, where a user would be able to create a document in the database with just an event name, which would be saved as a draft by default (published = false). I'd like the model to be able to validate whether an event can be set as published, and my thought was to define something like this in the model:​const EventSchema = new mongoose.Schema({name: {type: String,required: true,maxLength: 100,trim: true,},description: {type: String,required: false,requiredForPublish: true,maxLength: 5000,trim: true,},published: {type: Boolean,default: false,required: true,},...});​As far as I understand there's nothing stopping me from setting these kinds of custom properties on my schema fields, but how would I actually then use them? Say I wanted to have a pre-save hook that checks if we are trying to set published to true and if so, check that all the fields with requiredForPublish are set on the document, and throw an error if that's not the case.

Submitted May 20, 2019 at 03:47PM by sourtargets

Building a real-time word cloud from Twitch.tv chat with Node.js and Redis

https://medium.com/@mariotacke/building-a-real-time-word-cloud-from-twitch-tv-chat-with-node-js-and-redis-9470895c444a

Submitted May 20, 2019 at 03:00PM by mariotacke

Luna - manage npm dependencies through a modern UI

https://www.reddit.com/r/javascript/comments/bqvhx5/luna_manage_npm_dependencies_through_a_modern_ui/

Submitted May 20, 2019 at 02:34PM by rvpanoz

GraphQL Code Generator

https://blog.graphqleditor.com/graphql-code-generator/

Submitted May 20, 2019 at 02:29PM by oczekkk

Facebook marketing API is ridiculously bad

Hello,This is just a rant: I want to express to all of you how bad Facebook marketing API is. Having worked with beautifully crafted API like Stripe's, OpenTok, Twilio, DO and many more, I really wasn't expecting something so shitty coming from FBA few examples:1) Missing parameters error messages are not correct:A POST on https://graph.facebook.com/v3.3/XXX/adsets where a field is missing, but the name is there will result in a "error_user_msg": "The name field is required. Please complete the field to continue." You'll have to basically guess which field is missing2) In many cases, incorrect requests won't request a 400 bad request, but rather an "Unavailable endpoint" error3) I can't express how frustrating is the process to obtain an access_token, while being frustrating, it also doesn't make much sense on a security/best practises point of view (I'm talking about the short-lived vs long-lived tokens)

Submitted May 20, 2019 at 02:03PM by OogieFrenchieBoogie

Running a distributed system in node.js with Mokka!

Check out a new guide, how to build the distributed system with Mokka consensus algorithm:https://github.com/ega-forever/mokka/blob/master/examples/node/cluster/cluster.md

Submitted May 20, 2019 at 11:01AM by zuev_egor

Memory leaks in Node.js applications: How to debug them on Heroku

https://blog.sqreen.com/memory-leaks-nodejs-heroku/

Submitted May 20, 2019 at 11:38AM by dobkin-1970

A project based on a to-do app that ranges from building a todo-list web application to an API that interacts with the data.

Some time back, I embarked on a journey where i decided to work on project that is based on a to-do application for practice.Throughout the time, i managed to build a simple web application that employed the browser's local storage to one that was fully dynamic with nodejs in the back-end, a database and user registration.I also took a step forward to building an API that interacts with the stored data easily.Then recently I figured that i'd like to share it with others.The repo can be found here - https://github.com/alexnjoroge/toDo-list-project

Submitted May 20, 2019 at 10:10AM by culturalfeature

Promise.all for nested objects.

My first npm package:@arpitgo4/promise-objPromise.all's implementation for deeply nested objects and sub-arrays. It uses Promise.all internally for concurrent execution of promises.​Developed with TDD approach, do care to code review and comment.

Submitted May 20, 2019 at 08:48AM by arpitgo4

Sunday 19 May 2019

Building Node.js REST API with Express.js, MongoDB & TDD – Tutorial

https://novicedeveloper.com/building-nodejs-rest-api-expressjs-mongodb-tdd/

Submitted May 20, 2019 at 06:34AM by parripandian

Visual Studio Futures: Cloud-Based Development

https://dev.to/lostintangent/visual-studio-futures-intelligent-productivity-and-collaboration-from-anywhere-19gd

Submitted May 20, 2019 at 04:32AM by lostintangent

How to share node_modules between some projects

Hi,​I have some node projects to build which take some time in building processes. I want to speed up building time. To this objective, I want to share the node_modules folder between these projects. I want to configure npm to check the shared folder first when npm install command kicked, then take packages locally if they are already installed in the shared folder. I want npm to download packages only if they are not in the shared folder. I found prefix config in npm manual, but this item works only for the global install folder. Is there any config for my objective? Please.

Submitted May 20, 2019 at 03:22AM by hoge2

Node JS REST API file upload | Node JS REST API file upload example | ho...

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

Submitted May 20, 2019 at 03:39AM by renurawat

My first npm module: node-magic. An image and animated gif manipulation packaged designed for my discord bot

https://www.npmjs.com/package/@thatonegamer999/node-magic

Submitted May 20, 2019 at 02:53AM by thatonegamer999

Weird issue, could use some advice.

Puppeteer?

I've been doing a project with puppeteer the last few days trying to learn how it works. Has anyone run into bugs with it? I literally will have code that works, then the next day or even 10 min later it wont. Nothing on the website has changed, and even my code hasn't changed. Yet I will still get different outputs. For instance, sometimes the page.type() will work and other times I'll have to manually click on the field because puppeteer chooses not to focus on the element. Or sometimes I'll get a promise rejection where I've never gotten one before, because puppeteer isn't finding the element on the page, which I literally have a line that awaits for that element to appear before I try to do anything with it.​Does anyone else run into issues like this?

Submitted May 19, 2019 at 09:47PM by ight-bet

Authentication in Strapi (node headless CMS)

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

Submitted May 19, 2019 at 09:17PM by SammyStami

Scaffold a node library project quickly - https://github.com/lirantal/create-node-lib

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

Submitted May 19, 2019 at 05:54PM by lirantal

Array.from has a second argument

https://www.stefanjudis.com/today-i-learned/array-from-has-a-second-argument/

Submitted May 19, 2019 at 02:58PM by fagnerbrack

ClipBot: A free, powerful clipboard manager for desktops built with ElectronJS

https://github.com/codeshifu/clipbot

Submitted May 19, 2019 at 02:12PM by codeshifu

Automagically keep your .env in sync with .env.example before every commit

https://github.com/codeshifu/sync-dotenv

Submitted May 19, 2019 at 02:07PM by codeshifu

How to deploy a NodeJS server with NginX?

Hello,after 2 weeks of trying I just gave up and decided to ask for help.I followed multiple tutorials how to deploy a server on AWS, DigitalOcean and everything fails.Is there a idiot proof tutorial that will work 100%? Why the hell is it so hard to deploy a NodeJS server where Nginx serves static files? God damn it.For now Nginx is serving static files and nodejs is running on port 8080. How do I send any requests to nodejs? Like /users/online or something?

Submitted May 19, 2019 at 12:23PM by distro607

Hardware requirements question

Does anyone have any way to calculate the hardware requirements that your application will need based on a user assumption?I'm trying to find out if it's worth creating my own chat within my application or using other alternatives like firebase.​Thanks

Submitted May 19, 2019 at 07:05AM by gerson71

Saturday 18 May 2019

Looking for a library that takes all input from the keyboard (while supporting multiple language) on the DOM and send that back to my Node backend with socket.io.

Defining these key mappings shouldn't be the way to go. Surely someone has solved this before?

Submitted May 19, 2019 at 04:57AM by Lick_My_Lips_

Need help with basic POST/GET API stuff. Can pay if needed.

Hey r/node I am a total noob when it comes to nodejs and API's in general. I have put together a few working POST requests but am running into some issues with other requests from the same API. I am looking for someone who can help me 1 on 1, maybe via Discord. This should be a very simple problem for even a mid-level user so if anyone is in a helping mood, please PM me. I can pay if needed but would be very grateful if someone is also feeling charitable :)​Thanks in advance!

Submitted May 19, 2019 at 03:06AM by afkainoa

NodeJs docs don't explain what the functions do?!

What am I missing here?​https://i.redd.it/4n607v8dx0z21.pngIt seems like it's what I need right now, but I'm not sure what it's going to do. A Google search brought me here, now I have to do another Google search to figure out what Google's Node's functions do?The History isn't useful... the description should be right below the function name; you know, some kind of human-understandable explanation of why this thing even exists.Example of PHP's docs:​https://i.redd.it/c8dbgy6px0z21.pngThe description is right below the title, and if I don't understand the description, at least that's on me and I can just Google that... but having to Google for a description that isn't in the docs just seems silly, or maybe I'm not seeing how to find the description in the docs. Maybe Google has a mind-reading app I should already have installed on my Google phone?

Submitted May 18, 2019 at 08:51PM by davelipus

A quick Question about html user input

Sorry for this but my html nodejs English is lacking so I try to describe. If I want to make a blog with a submit text form that makes a new post on the page that saves into the html what should I search for? Is there a tutorial material for this somewhere? What is it called anyway? Thanks in advance guys!

Submitted May 18, 2019 at 07:13PM by Lakerman

Open Source Monitoring Tools

http://dev.to/sematext/node-js-open-source-monitoring-tools-440a

Submitted May 18, 2019 at 06:42PM by js_dom

Suggestion needed: Node.js geocoding

My Node.js webservice is hosted on Heroku with Postgres DB. I have user profiles table on it with {latitude, longitude} as the user's location.Problem: I have to fetch nearby places (10 miles) when a device shares its location (as zipcode or latitude-and-longitude).The help/suggestion I need is about this:This REST API https://www.zipcodeapi.com/API#radius returns zipcodes with in 10 miles radius from a given zipcode. (This API does not take latitude and longitudes as inputs which is a problem)​Is it good a architecture design or right thing to do if I call above external API and fetch all the zipcodes and then build a query SELECT usernames from MYTABLE where zipcodes in {RESULT_OF_API} and fetch the info from DB and return response to the device/browser?​Please suggest me better APIs to do this. I have checked Google API, but I did not come across an API that returns zipcodes with in 10 miles or similar. Please suggest.

Submitted May 18, 2019 at 05:13PM by yoyochuck

GitHub - phil-r/stats: 📊 Request statistics middleware that stores response times, status code counts, etc

https://github.com/phil-r/stats/

Submitted May 18, 2019 at 02:57PM by PhilR

OvernightJS now supports creating routes using arrows functions and es6 transpilation.

https://github.com/seanpmaxwell/overnight

Submitted May 18, 2019 at 03:48PM by TheWebDever

When using MongoDB, is it normal to use MongoClient.connect() a lot?

I thought I could call it once and then use collection.find() and whatever else I need when I need it, but it looks like I have to connect to MongoClient every time I interact with the database.Am I supposed to connect once and have a sort of global declaration of the database connection, or am I supposed to connect almost every time I'm interacting with the database?

Submitted May 18, 2019 at 01:12PM by WarAndGeese

Am I securing my node API properly

Hi everyone,Long-time lurker but this is my first post. I'm more just checking I'm doing this properly, as the info I've found online hasn't been much help to me so far...I'm making a node.js API that will, most likely, be used by other server applications such as WordPress. Therefore, I need to be able to generate one-time API keys for the user to input into their plugin.My current flow is the user logs into my website, creates an account (probably with Auth0, not 100% decided yet!) and is then given an API key (which will either be a UUID or random alphanumeric string) to add to their application. This API key will be hashed with bcrypt so it's not stored in the db as plain text. Then when the user makes a call to the API, the key is in the header which is then checked by the server to ensure the request is genuine.So, a few questions:Is this the correct way to do it?Any suggestions to make this better?Should I also generate an API key secret? If so, should this be sent to the user as well?Are there any good resources online for API design in node.js (specifically where API keys are issued)?Thanks in advance for your help. It'll be greatly appreciated!EDIT: Forgot the question mark in the title...

Submitted May 18, 2019 at 11:30AM by Korus1990

Splash CLI: 📸 Beautiful wallpapers from Unsplash 🖼️🛠️

https://github.com/splash-cli/splash-cli

Submitted May 18, 2019 at 11:47AM by rawnly

Friday 17 May 2019

Full-text search in node similar to Elasticsearch/Lucene?

I'm looking for a library for node that does full-text search.This is actually for desktop usage within Electron.Any recommendations?

Submitted May 17, 2019 at 11:15PM by brainhack3r

Query a remote server's operating system

Impress your colleagues with these NPM tricks

https://dev.to/borrellidev/impress-your-colleagues-with-these-npm-tricks-3fcb

Submitted May 17, 2019 at 11:40PM by philnash

Sails.js with Handlebars — or any other template engine

https://medium.com/p/eda1639c198e/

Submitted May 17, 2019 at 10:05PM by emadehsan

TO-DO LIST WEBSITE WITH USER REGISTRATION AND A LOGIN SYSTEM

Hey people, I spent some time building a fully responsive, to-do list website complete with user registration, logins and personalization of data just for practice and I was hoping you guys would check it out. Some feedback and a look at the code would be nice.Here's the website link > https://todo-list-website.herokuapp.com/and the Github repository > https://github.com/alexnjoroge/todo-list-websitePS: You can check out my Github account for other cool stuff and sorry for spamming

Submitted May 17, 2019 at 09:58PM by looper984

Recording a test with the Endtest Chrome Extension

https://www.youtube.com/watch?v=4DIVKcs--TA

Submitted May 17, 2019 at 07:29PM by dragnea_presedinte

Fullstack story app using MERN stack and Graphql part 5

https://youtu.be/YCEMZlgmF1E

Submitted May 17, 2019 at 04:47PM by ngovanhuong94

Best book for NodeJS and mongoDB

Hey guys, looking for some good book suggestion for learning NodeJS and MongoDB.

Submitted May 17, 2019 at 03:27PM by anuragmathews08

Help needed with passport authentication and for loops

Currently developing authentication using passportjs, express, mongodb.I had to do nested looping in order to check if username is already being used in multiple arrays. I have 3 for loops setup which is the problem. Whenever i sign up as new user (player in this case) it runs that code multiple times and signs up user twice/thrice with the same username but different ID of course, which is not what i want. I even have an if / else statement that checks if username is already used, but it ignores it.Here is the code:const game = await Game.findById(req.body.gameId); const allGames = await Game.find({}); const findPlayerUsername = await PlayerModel.find({username: req.body.username}); // Check if email is already used const existPlayer = await PlayerModel.find({}); if (existPlayer) { try { if (game.players !== undefined && game.players.length >= 1) { allGamesLoop: for (let i = 0; i < allGames.length; i++) { allGamesPlayersLoop: for (let j = 0; j < allGames[i].players.length; j++) { gamePlayersLoop: for (let k = 0; k < game.players.length; k++) { if (allGames[i].players[j].username !== req.body.username && game.players[k].username !== req.body.username) { console.log('Phase 1'); paHelper.registerPlayer(PlayerModel, passport, game, Game, req, res); } else if (allGames[i].players[j].username === req.body.username && game.players[k].username === req.body.username) { if (game.players[k].username === req.body.username) { console.log('Phase 2 NOTA'); res.json({message: 'Cannot have same username in the same game'}); } else if (game.players[k].username ``== req.body.username) { console.log('Phase 2'); paHelper.copyPastePlayer(findPlayerUsername, game, req, res); } } }; // For Loops }; }; } else { // Check if player doesn't exists if (findPlayerUsername.length === 0 || !findPlayerUsername[0].username) { console.log('Phase 3'); paHelper.registerPlayer(PlayerModel, passport, game, Game, req, res); // Check if players username is same as inserted username } else if (findPlayerUsername[0].username === req.body.username) { console.log('Phase 3.5'); paHelper.copyPastePlayer(findPlayerUsername, game, req, res); } } } catch (err) { throw new Error(err); } } else { res.json({message: 'Player Already Exists'}) } It kinda is a mess, because it has multiple conditional statements. Main problem is the first if statement in nested loops (phase 1). Though sometimes, code runs phase 3 and than phase 1 3 times.. which is not expected behaviour.

Submitted May 17, 2019 at 02:37PM by OMGitsBIP

Streaming Audio and Video

Hello guys, I want to create a webapplication for streaming live audio and video, maybe with the MEAN-technology. MongoDB, ExpressJs, Angular, NodeJS and socket.io - do someone know a tutorial for this?Thank‘s a lot!

Submitted May 17, 2019 at 01:28PM by daney_q