Saturday 30 November 2019

Node Python 2.7 requirement and running Python 3 in Windows

Hi, so I just installed Node in windows which also installed Python 2.7 along with other needed build tools. I wanted to use Python 3 in Windows and was installing Python 3 ( Anaconda ), but on doing so it is causing conflict. Because even on renaming Python2.exe and Python3.exe the pip file still has same name and many other scripts/executable.I usually use cmd and VS Code and don't have much use of Python 2 other than for Node / NPM.Any suggestions ?

Submitted December 01, 2019 at 06:39AM by NikhilDoWhile

Can someone translate this very simple rails code to node?

I am trying to verify an iOS app receipt using Firebase cloud functions, which uses node. Have previously done this in rails and it was quite simple, but I've searched for how to do it in node, and as expected with JS there are 10000 different ways, and as a non-js/node dev, it is extraordinarily confusing. Here is the rails code:def verifyReceipt begin uri = URI('https://buy.itunes.apple.com/verifyReceipt') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'}) req.body = {"receipt-data" => params[:receiptData]}.to_json res = http.request(req) render json: res.body rescue => e render json: { error: e } end end So far, this is my node code:exports.verifyReceipt = functions.https.onCall((req, response) => { const receipt = req.query.receiptData; options = { method: 'POST', url: 'https://sandbox.itunes.apple.com/verifyReceipt', body: ({ "receipt-data" : receipt, }), json: true }; var req = https.request(options, function(res) { // I understand I need to wait for the request to actually call Apple's server here...but how do I get the response as JSON here and then send it back to my app? }); req.end(); }); thanks.

Submitted December 01, 2019 at 03:57AM by moneroToTheMoon

Need help with deciding the microservice architecture

Hi,This is a first time I’m implementing microservices myself. Did anyone from you have done this kind of setup?​https://preview.redd.it/7cv5xx64tx141.png?width=685&format=png&auto=webp&s=0a59736aadc9393d2ce4b1e87ddba6d0c170228dThe application tier includes API gateway and the services who talk to databases.All the services are containerised Node.js servers and also acts as GRPC servers.The API gateway here is Node.js process that will convert REST requests into RPC to the target service.I'm also thinking of using Apache Kafka as message queue.I'd love to get some insight from you guys.

Submitted December 01, 2019 at 03:01AM by sohel211

Simple multi URL Data Scraper with using Node.js an NPM packages html-metadata and json-beautify

https://github.com/Pablo-Camara/simple-url-data-scraper-with-html-metadata-and-json-beautify

Submitted December 01, 2019 at 12:09AM by Pablo-Camara

The observer pattern in NodeJS

https://medium.com/@alonso.oliverio/the-observer-pattern-in-nodejs-c0cfffb4744a?source=friends_link&sk=0d507cacc984456ef39010eeb5de21b2

Submitted November 30, 2019 at 09:38PM by kiarash-irandoust

Need help on authentication architecture

Our team is building a small system in Node.js, and we're having a good time with Express and Sequelize so far. We're going to need an authentication solution in the next couple of months, though, and that's kind of worrying me right now. None of us have much experience with authentication in general. We've learned a couple of things about it in the Internet, but there are still important missing pieces in this puzzle.​Seeing as this new server (let's call it Server A) will share the same user database with another already established service running in the company (Server B), we thought they'd simply grant us access to this database in order to authenticate the users through Passport.js. They suggested doing something else entirely, to our surprise.​The suggestion goes as follows: the users will log in through Server B and be redirected to our new server by clicking a specific link in their user page. Server A would then receive a request from Server B with a special token containing some data about the authenticated user (email, resources he is authorized to read and edit, and so on), and take it from there. This way, Server A wouldn't need to query the user database in production and all authentication would remain entirely in Server B. We wouldn't even need to worry about HTTPS in Server A: once the user authenticates in Server B via HTTPS and their useful data are transferred to Server A, they wouldn't need to maintain a secure channel with Server A after that.​The main questions here are:​1- Is this architecture really feasible? Would we really be able to avoid using HTTPS in Server A if the authentication part is only used in Server B?​2- How would Express support this? In theory, they think we could achieve this by only treating the requests to the Server A home page, by checking if they come from Server B, and then proceeding to store the data received in a session or JWT token. Is it really that simple? How would Server A understand that the request from Server B is just an information to be used in a connection with another client? Would Passport.js be able to handle this situation somehow?​3- Would you use sessions or JWTs for this job?​4- Would we run into immediate CSRF problems or at the very least risk both servers this way?​5- Should I insist on the shared database solution, considering we just need a read-only access on it and it'll probably make things easier? I mean, we would only need to construct get/post routes for login and implement their logic, basically. The only extra challenge I can see with this approach is incorporating SSL/TLS in our service, something that's not part of the initial scope, but I feel it might probably be both more critical and easier to implement than I thought.​​Any help is appreciated. Thank you all in advance!

Submitted November 30, 2019 at 07:52PM by geoplasma

Running 2 or more node apps, process/cpu allocation?

I've been trying to look for a thorough explanation online but haven't been able to find anything. If I have a VPS with 2 cpus, and I run two separate node apps on that machine, how does node determine which cpu to run on? I'm not talking about running the same app in cluster mode- If I have two apps that do different things, but want to utilize my VPS thoroughly - will running node app.js then node otherApp.jsbe enough?What is actually happening here differently than if the app was the same and using cluster mode?

Submitted November 30, 2019 at 07:08PM by pomeloanthony

Promises and the FileSystem

So I'm currently working on a bot to do some Reddit moderation. I typically do db work and stay away from the file system so I believe I might be doing something wrong here.Essentially, the code below declares two variables from the returned values of an async call.// Check for previous contact. let [final_list, add_to_db] = await checkForContact(needs_comments, db); final_list.map(post => { console.log(post); fs.writeFileSync('./stuff.txt', `${post}\r\n`, { flag: 'a' }); }); final_list is an array of Promises that are set to be fulfilled by Promise.all() within the function. Upon returning here, the data should be written to a file. While it does write to the file, it only writes [object Promise] on each line.Am I missing something with the async call here?

Submitted November 30, 2019 at 06:11PM by vulpcod3z

FFMPEG Tutorial | Converting Mp4 to Mp3 On Command Line

https://youtu.be/D7m17pfC3sM

Submitted November 30, 2019 at 06:18PM by coderchrome123456

Node.js QRCode Generator for Text Library in Command Line and Application

https://youtu.be/Ope1uPFBhjY

Submitted November 30, 2019 at 05:20PM by coderchrome123456

Best db for key-value store

Which db do you all use when you need to store just key value pairs?? redis? sql(lite)?

Submitted November 30, 2019 at 04:13PM by ammarbinfaisal

Express Tutorial (Build a Mini Blog) : Backend Part

https://www.youtube.com/watch?v=7P8CWk_yvq4

Submitted November 30, 2019 at 03:28PM by Strengthenyourskills

How to find the TLS version for the HTTPS Request library?

Hey everyone, I am running on Node v10.16.0 and I have a client and server both using HTTPS. I am trying to measure the performance of my network, in particular the https.request(GET) my client makes to the server. I have a question that I can't seem able to answer:What version of TLS does Node v10.16.0 http.request run?

Submitted November 30, 2019 at 03:34PM by thatcsguy1

Problem installing npm modules

Hey people,I'm trying to install ts-node with typescript. I'm having the following error (even though I have the most recent typescript):UNMET PEER DEPENDENCY typescript@>=2.0when installing ts-node (globally and locally). Tried to remove the packages from packages.json, uninstall and install globally and locally but nothing helps.​Can anybody give a hand resolving the issue? Many thanks :)

Submitted November 30, 2019 at 01:13PM by int3rsys

Simple Node Blog in Express and MongoDB in 15 minutes

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

Submitted November 30, 2019 at 09:15AM by coderchrome123456

Q: Shared Files between frontend and backend

I want to build a fullstack app using: React and mobX in the frontend, and express and typegoose and type-grapqhql in the backend.The question is: Can I share the model files between the mobX and the typegoose & grapqql? And how?

Submitted November 30, 2019 at 11:46AM by Mi3LiX9

Friday 29 November 2019

Text file to array issues

Hello all, I've recently starting to teach myself JS I'm having some issues converting the contents of my text file into an array. Here's my code:​https://preview.redd.it/avq2lezkur141.png?width=1579&format=png&auto=webp&s=497dfbc39c4f65bbe47be865bf7c189144299051My issue is when I go to output the contents of ResultArray. The array contains a blank element no matter what I change in my code block.​When I input \"1\", this is what ResultArray looks likeWhen I input \"2\"When I input \"3\"I've been struggling with this for a while- If you have a solution to my issue, I'm all ears.

Submitted November 30, 2019 at 07:05AM by oldBurnsey

What are event emitters used for?

Is there a reason why event emitters could be useful in a Node.js application? Did you ever use an event emitter in a Node.js application? Why?

Submitted November 30, 2019 at 04:14AM by jesusscript

Modern JS tooling is too complicated. Yep? Nope?

https://changelog.com/jsparty/89

Submitted November 30, 2019 at 04:39AM by fagnerbrack

New to Node and need a little help/information.

Hey, yesterday I was bored and decided to make a little project.The plaan was that you can go on my website which is hosted on my pc see a textbox in which you can enter a text when you press submit the text will be repeated as Text to Speech from my computer (just a little "nonsense" prject to learn some new stuff). The Text to Speech part is what brought me to NodeJs so I started learning a little bit of the syntax and behavior of NodeJs. Now I have a problem I expected that i could execute a NodeJs file similar to an PHP file enbedded into an HTML script but after some research i could not find an easy answer on how to execute a NodeJS file after clicking a button on a webpage. So my question is how to do that if it is even possible (I just could not find anything in that direction). I am using WampServer to host the Webpage.Thanks in advance!

Submitted November 30, 2019 at 03:33AM by ElaijahTheHood

I finally did! Musician finally crosses over to programmer and makes her first program - voice tuner.

Anyone know of a way to profile why nodemon app restart (using webpack build/watcher) takes long sometimes?

Have an app that recompiles on any backend code change (using webpack watcher). The webpack bundling is fast, but then nodemon takes notice of the build change, and tries to restart, but it sometimes takes a while (10+ seconds). Not only that, it will also restart several times on its own during this process, without a file change, ie:[nodemon] app crashed - waiting for file changes before starting... [nodemon] restarting due to changes... [nodemon] starting node build/api.js [nodemon] restarting due to changes... [nodemon] starting node build/api.js [nodemon] restarting due to changes... [nodemon] starting node build/api.js API server listening on http://localhost:3000 Is anyone familiar with this happening, or might have advice for profiling why nodemon is taking a while, or maybe there is a better process manager or something? I've tried pm2 before, will give it another go...I'm a pretty seasoned developer, and have used node a while, but at this point, it's become a headache a lot, with stuff like this, and recently the app sometimes won't even respond to requests. Just sits there saying it's running, but backend doesn't respond (fetch requests stay pending). Restarted the app several times successfully, but didn't help. I had to restart the computer for it to get back to working. Sometimes it does this because of invalid backend code (for instance I once accidentally had new DateTime() instead of new Date()), and it couldn't detect this at all and produced no error, but the server would just hang. Considering just moving to Java or even PHP again.

Submitted November 29, 2019 at 10:36PM by rw3iss

Javascript: Private fields, public worries

https://medium.com/virtuslab/private-fields-public-worries-b8c34d16c372

Submitted November 29, 2019 at 09:50PM by filipoi

Rails Developer Looking to Transition to Node/Express

Hey everyone! I am a web developer that uses Rails, React and Postgres in nearly all of my applications.I decided that I would make the switch to Node because it is in high demand and seems much more lightweight/faster than Rails. (Also I want to eventually create some React Native mobile applications, and I believe Node is the backend for those, although I could be wrong).Do you have any advice for someone transitioning? I bought these two courses on Udemy to get started:https://www.udemy.com/course/the-complete-nodejs-developer-course-2/https://www.udemy.com/course/node-with-react-fullstack-web-development/If you have any other course recommendations or general tips, please let me know!

Submitted November 29, 2019 at 08:23PM by Helkdog

Express JS - Passing variable value to view

Hey there, I'm somewhat new to Express and I'm having trouble understanding how I would pass a variable outside a function to the view.Here's where I'm defining the variable: hasVoted(steamid).then(results => { var voted = parseInt(results) // This is the variable I wish to use }) }) I want to pass it to the view, the attempt I've tried here has failed (I assume because my variable definition is in a local scope)app.get('/', function(req, res){ res.render('index', { user: req.user }, { isvote: voted }); }); Is there another option for me to pass data to the view, or can I somehow make my variable global so I can pass it to res.render?

Submitted November 29, 2019 at 07:18PM by AyjayMartin

I have created Angular + Node full stack Application that shows npm package dependencies - let me know what you think

I have created Angular + Node Full stack Application that shows npm package dependenciesI created it to be as simple as possible( 1 week work few hours a day)Github repo: https://github.com/saifabusaleh/npm-dependency-graph​I used axios + express + wrote simple tests with Jest​let me know what you think

Submitted November 29, 2019 at 06:27PM by ExectAsync

To import functions or to write in the same file in RESTful?

I'm still learning Node and Express. I want to know what is a better practice:- Should I write functions that'll be used in the HTTP requests inside app.js and use them within the same file- Or should I create a separate file with exported functions and import them in app.js?Thanks!

Submitted November 29, 2019 at 05:47PM by optechhas

Microservice example projects

I'm looking for some example repos about microservices which involves multiple of these things interacting with each other to get an idea of how to get started with it. I know the theory, but I've never seen any code regarding it.Also a quick question, if I require some data in a way that it needs joins/lookups across multiple tables/collections, how would a microservice architecture handle it?

Submitted November 29, 2019 at 05:16PM by abhi12299

Writing a RESTful API with Express & MassiveJS

https://medium.com/@alexishevia/writing-a-restful-api-with-express-massivejs-465218800c08

Submitted November 29, 2019 at 04:23PM by mariuz

What are some robust microservice oriented frameworks?

Hi,Are there any good microservice oriented frameworks in nodejs?My requirements:great community support + resourcesAPI should not change often drastically like some JS frameworksmicroservice oriented and easy to get startedmaintainable in the long run

Submitted November 29, 2019 at 04:20PM by git_world

Database as API with PostgreSQL and Massive.js

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

Submitted November 29, 2019 at 02:52PM by mariuz

Express + PythonShell - first request is always the slowest

Hi All,I`d like to raise a question in case somebody is familiar with this or has an idea.I`ve created an API using ExpressJS and for some POST routes, I`m using Python-Shell to call some scripts which takes the body from the POST request to do something with the data.A really weird thing that I am notificing is that whenever I am sending a request to these routes which call Python scripts (could be more than 1), the first request always takes the longest, then the more I use the route (send requests) the faster the reponse is received.It feels like the API is in an idle state, then 1st request comes in, it takes a while, then it`s getting used to getting calls to this route and behaves faster and faster. Latest test, 1st request takes 3 seconds, then 1s, then below 1s etc. etc.I`m thinking it might have something to do with the runtime of the scripts and spawning processes the call these scripts​Edit: inside the POST route, I have created a method which return a Promise with the results from the python script.Something likeexampleMethod : (json, pythonPath, pythonScript) => {return new Promise( (resolve, reject) => {let options = {mode: 'text',pythonPath: pythonPath,pythonOptions: ['-u'], // get print results in real-timeargs: [json] //json is data received in the body of the POST};// Here I call the Python scriptconst pyshell = PythonShell.run(globalPath + pythonScript, options, (err, results) => {if (err) {console.log('Error');console.log(err);reject(err);}});pyshell.stdout.on('data', function(data) {// console.log('Data: ',data);resolve(data);});pyshell.end();});}​Then in the POST request, I am calling the exampleMethod().then() to get async the results and continue the logic.​Many thanks!

Submitted November 29, 2019 at 11:57AM by Devtopia

ExpressJS : Create Login App with JWT

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

Submitted November 29, 2019 at 10:54AM by Strengthenyourskills

Node.js Pagination in Express and MongoDB

https://youtu.be/iO2uS-1y3fc

Submitted November 29, 2019 at 09:36AM by coderchrome123456

Thursday 28 November 2019

How to use Stub in unit tests?

I am trying to learn unit testing in past few days. I have following test file ::​var expect = require('chai').expect;var _ = require("lodash");var gridV2 = require('../routes/v1/mobile/gridV2');​let req = {ids : [1,2,3]}, res = {};​describe('TEST', function () {it('Test 1', function (done) {gridV2.fetchData(req,res, function (){//this function modifies req object do some checks on req and call donedone();});})});​The fetchData function is like this :​fetchData : function (req, res, next) {db.fetchDatafromDB(req.ids, function (results){next();})}​How do I mock fetchDatafromDB call as it's making a db call. I know we can use sinon but I am not finding any helpful tutorials.

Submitted November 29, 2019 at 07:10AM by GhostFoxGod

Thoughts why postgres pool doesn't throw an error(nothing happens) when using systemd?

This has been a nightmare for me, I'm trying to get this to work on a Raspberry Pi.As far as I'm aware/can tell there is nothing wrong with the "code/connection" I'm thinking is a permission issue, I just don't know what's wrong because I can't get any sort of error.In mypool.query((error, results) => {// handler})error is an empty object and results is undefined. It is running, I can see it in htop.The issue is, if I run the express app through the command line manually eg. $node index.js it works... same code. But with systemd even setting the user, the query doesn't work, I don't get an error or a result... I don't believe that it's an async issue either(tried it).I've been messing around with users, table ownership, etc... I can't get past this problem of nothing happening, even putting a .catch there's no "error"

Submitted November 28, 2019 at 09:55PM by crespo_modesto

What are the most advanced features you had to implement using Kubernetes as a Node.js developer?

Can you tell us what were the issues you encountered and how you solved them?

Submitted November 28, 2019 at 10:44PM by jesusscript

What were the most advanced features you had to implement with Kafka using Node.js?

Kafka is one of the many tools that are being used to scale web applications. Have you ever used it? If so, what were the most advanced features you had to implement using Kafka?

Submitted November 28, 2019 at 10:45PM by jesusscript

Is it possible to use a different proxy for each Chromium tab with Puppeteer?

Hi everyone,​I'm having difficulty finding a solution for the following problem: I'd like to have a single browser instance with multiple tabs, each with their own unique proxy. Is this possible with Puppeteer?​Thank you

Submitted November 28, 2019 at 07:09PM by PermeabilityOfSpace

How to set AWS environment variables

Hey,I have some private strings in my app which are in my gitignore file.Now, I want to deploy my node application on AWS by cloning my git repository. In advance, I want to create variables on my AWS account to change my codebase that my app will access the variables when it's uploaded on AWS.I'm googling since a while but I found many different ways which confuse me a bit.Does anyone know how to do this?

Submitted November 28, 2019 at 07:21PM by rochenExklusive

Displaying images without using a framework

Hey, so I'm trying to display an image in nodeJS, but we're not supposed to be using frameworks.​This is what I've tried so far (with EJS as a templating language):
  • pizza pic <%= pizza.name %> - <%= pizza.price %>
  • That's what I've tried so far, but from what I've managed to gather, a separate request is sent when fetching an image and that has to be handled separately. How would one go about doing this? The rest of my code seems to be working fine.​Thanks

    Submitted November 28, 2019 at 05:51PM by indisapien

    Small, simple json based alternative to dotenv.

    https://www.npmjs.com/package/config-dot-json

    Submitted November 28, 2019 at 04:06PM by ---jason

    Using PostgreSQL with Express

    https://www.youtube.com/watch?v=5Uo5FuAex04&t

    Submitted November 28, 2019 at 04:07PM by Strengthenyourskills

    Anyone using systemd for persistence?

    Just wondering your work flow, I'm pretty new to node and systemd was one way I found to do this.I discovered that if you change your files(on server) you need to reload the daemon and also restart your service for the files to change... wondering if that's normal/part of workflow. Probably should be avoided?The other thing I gotta look into is proxying as I would prefer to use port 80 usually or 443 but still be able to have multiple domains like virtualhosts in Apache.

    Submitted November 28, 2019 at 03:27PM by crespo_modesto

    What should I know to do this with an API?

    Trying to learn Node, what should I learn to work like that:This url https://jsonplaceholder.typicode.com/posts/ load all posts. After the / I can insert any number to load specific data.My question is: how to load data using Node with own url? Eg: myurl.com/posts load https://jsonplaceholder.typicode.com/posts and myurl.com/posts/1 load https://jsonplaceholder.typicode.com/posts/1. I think it's like an api gateway.

    Submitted November 28, 2019 at 12:52PM by IllustriousFeedback2

    Cors installed but sill getting networkError on node server

    I have the local server running, and also have Cors installed using npm, and the server.js file aslet express = require("express");let cors = require('cors');let app = express();app.use(cors())app.use(function(req, res, next) {console.log(\${new Date()} - ${req.method}request for ${req.url}\);next(); // pass control to the next handler});app.use(express.static("../static"));app.listen(81, function(){console.log("Serving static on 81")});​However, once I navigate to the file, I am getting this error:Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://10.0.0.14:81/tfjs-models/mobilenet/model.json. (Reason: CORS request did not succeed).Error: Request for http://10.0.0.14:81/tfjs-models/mobilenet/model.json failed due to error: TypeError: NetworkError when attempting to fetch resource.​Any tips on how to solve this?

    Submitted November 28, 2019 at 12:25PM by wymco

    GraphQL Editor - now free with free namespace & 2 projects

    https://graphqleditor.com/

    Submitted November 28, 2019 at 11:30AM by ArturCzemiel

    Confusion about duplex streams

    I'm working on a data-sink of sorts that is eventually to be used for Key-Value object streams in nodejs.I've stumbled across duplex streams and started playing with them a bit to get my feet wet, but everything I try seems to not work.At present, I've got this duplex stream:``` class StorageStream extends stream.Duplex { constructor() { super({ objectMode: true })this.values = new Map(); this.entries = this.values.entries(); }_write(data, encoding, next) { const { key, value } = data;this.values.set(key, value); next(); }_read() { const next = this.entries.next();if (next.value) { this.push(next.value); } } } ```This is a SUPER CONTRIVED example, but essentially, when I write to this stream it should store the key and value in the Map, and when I read from this stream it should start reading from the map and passing them down the stream. However, this doesn't work, doing basically the below``` const kvstream = createKVStreamSomeHow(); // a basic, readable stream with KV Pairsconst logger = createLoggerStreamSomeHow(); // writable stream, logs the data coming throughconst storage = new StorageStream();kvstream.pipe(storage).pipe(logger); ```causes the process to just end. So I guess I'm just a bit confused as to what I'm supposed to be doing inside of the _read method.

    Submitted November 28, 2019 at 11:43AM by notAnotherJSDev

    Heroku filesystem restart

    Hello,I want to deploy my node application on a free hosting service as I want to show it to a company to land a job.Now, in this application the user can add products and upload images of the product.On heroku, everyday the filesystem gets restarted, this deletes all the images. Also, when an error occurs the filesystem gets deleted.It's recommended to store all files on AWS S3. This seems like quite some work because I have to make many changes in the codebase and I need to have the application ready by tomorrow.Are there other ways of getting around this problem?

    Submitted November 28, 2019 at 09:28AM by rochenExklusive

    Localization in Node

    Hey, I use express.js and I need to have my page multiple languages I don’t use React, I use ejs as view engine. Is there any way to localize page. Could you please share some links .Thanks!

    Submitted November 28, 2019 at 09:50AM by elshan_

    How Node.js can help you maximize IoT productivity

    Ever since Node.JS came into existence, it has become popular among various developers across the world in making APIs and constructing new matrices that are utilized on the internet. Node is a highly powerful tool, but that doesn’t mean it is perfect for every project. Before you get in touch with a reputed node.js development company, know why you want to utilize this platform in the first place. If you’re handling a big project with a broader scope, it is better to settle for Node.JS as it is a great choice.Node.js Provides an Easy ScalabilityOne of the prime benefits of Node.JS is that developers find it quite easy to scale the applications in horizontal and vertical directions. The applications can be scaled in a horizontal way adding extra nodes to the existing system.Furthermore, Node.JS also provides you with the option of putting additional resources to the single nodes during the vertical scaling of the application. So, it is extremely scalable and gives a much better option compared to other JavaScrip servers.Hire node.js developers to help in adding convergence of efficiency and functionality as per your business needs.Role of Node.JS DevelopersAs Node.JS is evolving technology, it is a hot skill possessed by any developer for the instant and near future of modern web application development. A perfect understanding of Node.JS will assist you in utilizing JavaScript to expand real-time, quick, scalable, data-driven web applications.It also permits you to rapidly adapt to any of the appearing, cutting-edge JavaScript technologies. As Node.Js core and its applications are broadly divided into modules, they are shared and well-composed. All the tools and packages are well-crafted and scooped tightly into manageable parts that are baked together.Get in touch with a trusted node.js development company and acquire reliable and suitable solutions for your business.Maximize IoT productivity with Node.JSThinking about why Node.js is a perfect and natural fit for IoT applications is understandable. To leverage technology to activate business expansion, you need to keep an eye on technological growth as well. It is the prime way of how big firms are evolving by recognizing the next ‘big thing’.To withstand the hurdles and achieve smoother flow in a business, sooner or later, all companies need to obtain data management tools, intelligent solutions, and excellent network control. IoT is all about linked and synchronized environments across various systems that consist of the integration of microservices, wireless technology, web, devices, and sensors.The prime purpose of utilizing Node.Js in IoT applications is the quicker and real-time execution. On the server-side, it also engages less memory and results in an effortless performance. Hire node.js developers and obtain great support of low-source needs and APIs.

    Submitted November 28, 2019 at 10:58AM by MetaDesignSolution

    Node.js MySQL Crash Course | Node.js MySQL CRUD App

    https://youtu.be/cfff2lQfXsw

    Submitted November 28, 2019 at 09:25AM by coderchrome123456

    Simple webhook example

    https://github.com/trmaphi/theoreticalCS/tree/master/webhook-js

    Submitted November 28, 2019 at 08:46AM by trmaphi

    Wednesday 27 November 2019

    Need help with deploying Node apps with K8s

    Hi,I'm using GitLab and working on a rather large project. My repository is a monorepo that contains several packages, some dependent on others.Previously I would set up my CI/CD on a single runner with shell access sl that my projects would be deployed properly, however, I want to scale up and figured using Docker would help, as well as not having to micromanage Node.js versions.Is there anyone here with a properly set up Docker / K8s CI/CD pipeline specifically for Node.js? I'd love to get some information on where to start or articles that dumb it down a slight bit.

    Submitted November 28, 2019 at 01:57AM by Cyberuben

    Beginner learn the correct way of module.exports and global variables

    What I get from most of the answers I could find is we should not use global variable lightly.Using NodeJS, we can use module.exports and then require in files that are needed.What I would like to know is would the variable get initialize again on multiple require ?For example on database connection using Sequelize:let sequelize = new Sequelize(...) module.exports = sequelize If file1.js require, it will then creates connection to database.What happens on other files that require it later on? Will it initialize connection again? If so, how do I make it like Singleton?​Sorry if this has been asked before or my understanding is wrong.Thank you in advance.

    Submitted November 28, 2019 at 01:14AM by xjellyfishx

    How to wait on an async.timeseries()?

    Here is my code:function myFunction() { // do stuff } async.timesSeries(100, myFunction); doSomethingElse(); The problem is that doSomethingElse() is executing before every execution in async.timesSeries() has finished. Sorry for my ineptitude at NodeJS, but does anyone know a quick and easy fix for this? Thanks!

    Submitted November 27, 2019 at 10:03PM by thatcsguy1

    Node vs Python for RSS Parsing

    I am trying to parse RSS feeds and quickly update my MongoDB using Node, I tried worker_threads. mixing threads and promisses is not working very well. My code with worker threads without using promisses working very well and fast, when i added database operations with await, all stops. I did a lot of testing and just using promises is getting faster.​Any has any suggestion for this?I was thinking of switching to Python and hopefully get better results​Any advice or suggestions greatly appreciated

    Submitted November 27, 2019 at 10:04PM by enigmatic5000

    Animated: JavaScript Regular Expressions Course For First 10 People

    Dislaimer: This is a paid Udemy course but FREE COUPONS have been created for first 10 people to redeem.​Regular Expressions In JavaScript: The Animated Guide 2020Learning Regular Expressions can be hard especially for beginners. But it doesn't have to be that way. I learned Regular Expressions years ago by hard trial-and-error. Now you can learn at 5x the speed I did. This is the course that I wish I had when I first got started with Regular Expressions.I spent over 100 hours on creating the Regular Expressions In JavaScript course by using Visual Illustrations, Tips & Tricks, and Short Animations to explain confusing concepts in Regular Expressions. The course (currently) consists of over 30 lectures. More is coming.If you'd like to enroll, here is a free coupon code: REDDIT_DEV (limited to 10 enrollments) OR visit the link below:https://www.udemy.com/course/javascript-regular-expressions/?couponCode=REDDIT_DEVYou will also get some practice using regular expressions, and then you will use all that you've learned to build a dynamic Client-Side Form Validation System that uses Regular Expressions And JavaScript to validate the data typed in. By the end of this course, you will gain valuable information to read and create your own regular expressions.NOTE: If the coupon has been exhausted and you'd also like to pay anyway if you are still interested, that's greatly appreciated. Here is a $9 coupon code: EARLY_BIRD ( Expires 12/01/2019 11:12 AM )https://www.udemy.com/course/javascript-regular-expressions/?couponCode=EARLY_BIRDBut if you're not 100% sure yet, just go ahead and watch the promo video and free lectures. I promise you will be amazed :)An honest feedback and sharing is greatly appreciated!Preview of sample lectures:Previes of sample animated lectures

    Submitted November 27, 2019 at 08:20PM by silverparzival

    Node.js hardware suggestion AMD or INTEL ?

    Hey I am looking to buy a new hardware for my nodes.js server and atm I am stuck on which cpu to buy? My system is meant for a multiplayer game with lots of computation so all the x, y (2d) stuff includes angle calculation distance calculation with square function etc. Also there is a lot of chunking of arrays down for each client.Currently I have a Intel Pentium N3710 quad core Synology System DS916+ MariaDb and Iam programming only single threaded so my target would be a good single thread cpu . For future targets I also want to have multi core .Future setup would be my nas for myself a good nodes.server(good cpu) and some raspberry pi for the little stuff like Mysql which runs for backing up stuff.My question would be for which benchmark should I look for when comparing the different cpus to be able to fulfill my needs also should I look for fast ram due to from what I understood nodes runs in a event loop ?Would be nice to get some good feedback

    Submitted November 27, 2019 at 06:46PM by Dex2k2

    Puppeteer Starter Project: Scrape Page Content

    https://www.reddit.com/r/puppeteer/comments/e2kdtz/puppeteer_starter_project_scrape_page_content/

    Submitted November 27, 2019 at 06:55PM by i_am_extra_syrup

    No TCP or TLS handshake happening in the https.request() call?

    Here is the client code I am working with:var options = { hostname: "my host", port: 8080, path: '/', method: 'GET', key: fs.readFileSync('clients key'), cert: fs.readFileSync('client cert'), ca: fs.readFileSync('CA cert'), rejectUnauthorized: false, }; // code to get current time var req = https.request(options, function(res) { res.on('data', function(data) { process.stdout.write(data); }); }); // code to get end time and thus calculate total time of transaction. But end == start time! req.end(); Here is the server codevar options = { key: fs.readFileSync('server key'), cert: fs.readFileSync('server cert'), ca: fs.readFileSync('CA cert'), requestCert: true, rejectUnauthorized: false }; https.createServer(options, function (req, res) { res.writeHead(200); res.end("Hello client" + "\n"); }).listen(8080, "host"); So right now I can successfully make a GET request from my client to my HTTPS server (haven't actually added in a resource to retrieve yet). The thing is, when I print out the time for the client to make the http.request() and the time it finishes (both in ms), they are the same! The connection between my client and server has an inherent baseline 5ms delay which clearly shows something is wrong, as my start time == my end time (where as my end time should be ~10ms more than my start time).My first guess is that I need to manually perform a TCP handshake and/or a TLS handshake, although I assumed that would be done under the covers by http.request(). Am I missing something here? Do I need to be doing something else to perform a handshake? Thanks!

    Submitted November 27, 2019 at 06:56PM by michaelrichard70

    How to Run MongoDB as a Docker Container in Development - Cloudnweb

    https://cloudnweb.dev/2019/11/how-to-run-mongodb-as-a-docker-container-in-development/

    Submitted November 27, 2019 at 06:21PM by GaneshMani

    Nodemailer Not Working Properly

    Hey everyone, I am having an issue with a code I am writing. I am developing a code to act as a login screen that compares that input to a MySQL server and database. Everything is working wonderfully, but the issue I am having is when someone access the New User page and submits their info to the database, I am trying to send an email that will give the new user an authentication number they have to submit. But every change I make to my code with nodemailer, it won't send the email. The data is still submitted to the server, just no email is sent.My portion of the code that I am trying to work on:var transporter = nodemailer.createTransport({host: "smtp-mail.outlook.com",port: 587,secureConnection: false,secure: true,ignoreTLS: false,requireTLS: true,auth: {user: 'user',pass: 'pass'},tls: {ciphers: 'SSLv3'}});var mailOptions = {from: 'user',to: email,subject: 'Please Verify Your Account!',text: authenticationNumber};transporter.sendMail(mailOptions, function(err, info) {if(err) {console.log(err);} else {console.log(info.response);}});​The error I am getting is this:[Error: 3408:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:] {library: 'SSL routines',function: 'ssl3_get_record',reason: 'wrong version number',code: 'ESOCKET',command: 'CONN'}​I have tried looking on Google and anywhere I can find to solve this issue, but I haven't been able to find anything for the past 2 weeks. Any help would be much appreciated.

    Submitted November 27, 2019 at 02:25PM by Caddburry00

    How to avoid over engineering? | Software Brothers Blog

    You know what they say - "the best is the enemy of the good" and it actually corresponds pretty well with the work of programmers.You see, sometimes an excessive diligence and perfectionism when writing code outweighs the needs and requirements of the client, his budget and agreed deadline.In our new article, one of our top developers explains what is the characteristic of over-engineering, its causes, ways to avoid it and deliver projects on time. We hope you'll find it useful! 💪https://softwarebrothers.co/blog/how-to-avoid-over-engineering/

    Submitted November 27, 2019 at 02:21PM by SoftwareBrothers

    Is there any good video course on how to implement a streaming distributed system with Node.js and Kafka?

    I heard this is the leading edge in distrbuted computing, so it would be sweet if I could get my hands on such a course.

    Submitted November 27, 2019 at 01:27PM by jesusscript

    How to create import aliases with Babel's Module Resolver

    https://www.robinwieruch.de/babel-module-resolver

    Submitted November 27, 2019 at 01:06PM by rwieruch

    Should I write both Unit and Integration tests for my web apis?

    So, recently i got into testing web apis, following the structure of bulletproof nodejs repo, and I started making tests, mostly integration with supertest and jest. my question is: when i finish writing integration tests, should i write unit tests as well? I am asking this as i have services and routes separated and in some of routes i might even use two service.​also, i've got one "bonus" question for integration tests. currently i am creating new express app instance and importing my routes in test file(i have got routes and middlewares as loaders), and then i am using supertest to test my routes, is this the right approach?

    Submitted November 27, 2019 at 12:20PM by warchild4l

    What exactly does the Yargs library do?

    "Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface."Pasted above is the description from their website. I have also looked at a few of their examples, but I am feeling relatively lost in trying to come up with a basic understanding of what problem this library solves.

    Submitted November 27, 2019 at 12:21PM by mementomoriok

    ElectronCGI - A way to run .Net in Node.js

    https://www.blinkingcaret.com/2019/11/27/electroncgi-a-solution-to-cross-platform-guis-for-net-core/

    Submitted November 27, 2019 at 11:58AM by ruidfigueiredo

    7 Methods for Working With Directories in NodeJS

    https://coderrocketfuel.com/article/7-methods-for-working-with-directories-in-node-js

    Submitted November 27, 2019 at 11:58AM by r-wabbit

    Is it possible to use node filestream on .md files?

    Currently, I am using nodejs to read and write .txt files. I am wondering if I will encounter any problems if instead of .txt files, I try to write .md files or .docx files.

    Submitted November 27, 2019 at 12:09PM by mementomoriok

    Building A Spec Compliant Promise Implementation From Scratch

    https://www.youtube.com/watch?v=4GpwM8FmVgQ

    Submitted November 27, 2019 at 11:17AM by FrancisStokes

    Websockets server in browser client

    Hello, I'm wondering if it's possible to have a WebSockets server serving an API in the nodejs browser client?

    Submitted November 27, 2019 at 08:34AM by sum_guy55

    Is node capable of text mining?

    I'm playing around with 2GB chat conversation data. I need to create chat bot like functionality where I can mine the data and analyze the data. But everywhere i look i find data/text mining being done in python and r. But I want to do it in node. is it possible? if yes, then how? is there a library? i saw `https://www.npmjs.com/package/text-miner` but it's really slow on large dataset. Nearly impossible to work with it. what would you suggest ?

    Submitted November 27, 2019 at 08:59AM by sharik709

    Automate and Qualify your Lead Generation with Build on Standard Library and Nodejs

    https://medium.com/@janeth_10755/automate-and-qualify-your-lead-generation-with-build-on-standard-library-73237ce3dee4

    Submitted November 27, 2019 at 08:16AM by JanethL

    Real Time Chat App Using Node.js Express and Socket.io (WebSockets)

    https://youtu.be/oJOFFRpq9uM

    Submitted November 27, 2019 at 07:35AM by coderchrome123456

    Tuesday 26 November 2019

    Generate CSS Selector for Puppeteer?

    I'm coding a bot using Puppeteer where I created scrapper classes that interact with web pages. The purpose is to have every CSS selectors in one place for better maintainability in case the web site interface changes.At the moment, to select a button on the page I'm doingconst button = await page.$("div > div: not(:first-child) > ul > li > button")I find the CSS selector clumsy written this way. It's error prone when writing such string and I'm wondering if one of you ever used a library to generate such a string in a more reliable way. Something like this for example :div().div({firstChild: false}).ul().li().button()Any suggestions?

    Submitted November 27, 2019 at 05:20AM by baboo77777

    For the life of me, I can't figure out why I can't connect to MongoDB

    I am using mongoose to connect to mongodb. I have this connection code (below) and I just keep getting the error of MongoTimeoutError: Server selection timed out afterconst connection_string = 'mongodb+srv://' + config.MONGO_USER + ':' + config.MONGO_PASSWORD + '@cluster0-5398r.mongodb.net/basic-contacts?retryWrites=true&w=majority' console.log("CONNECTION: " + connection_string); mongoose.connect(connection_string, { useNewUrlParser: true, useUnifiedTopology: true }).then(result => { console.log("RESULT: " + result); }).catch(err => { console.log("ERROR: " + err); }); I have a database called basic-contacts and a collection called contacts. I know my username and password are properly passed in and are correct.What is strange is i went to previous projects I made from tutorials and they are also failing in the same way.Please help

    Submitted November 27, 2019 at 02:54AM by Srz2

    How do you implement a distributed system with Node.js?

    I have been wondering if it's possible to do it easily. So far, I have been using worker threads to scale up my application, but I never implemented anything like a distributed system with multiple server. How do you do this?

    Submitted November 26, 2019 at 08:07PM by jesusscript

    Why isn't my method being defined?

    Hello to all! New to backend/database, and I'm trying to learn how to use the Sequelize ORM. I'm trying to connect everything and it's giving me a TypeError: db.define is not a function error. My code is below​db.jsconst Sequelize = require('sequelize') const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_USER_PASSWORD, { host:'localhost', dialect:'mysql', define:{ timestamps:false }, pool:{ max:5, min:0, acquire:30000, idle:10000 } })var db = {};db.Sequelize = Sequelize; db.sequelize = sequelize;db.customers = require('../models/Customer.js')(sequelize, Sequelize); db.booths = require('../models/Booth')(sequelize, Sequelize);db.customers.belongsTo(db.booths); db.booths.hasMany(db.customers);module.exports = db; Customer.js Modelconst Sequelize = require('sequelize') const db = require('../config/database')const Customer = db.define('Customers', { customer_id:{ type:Sequelize.INTEGER, primaryKey:true, autoIncrement:true }, customer_name:{ type:Sequelize.STRING }, customer_phone:{ type:Sequelize.STRING }, active:{ type:Sequelize.BOOLEAN } })module.exports = CustomerBooth Model is pretty much the same. Any Ideas?

    Submitted November 26, 2019 at 08:13PM by kingducasse

    GitHub - postput/postput: Cloud native storage operator - Upload, download and perform operations on your files

    https://github.com/postput/postput

    Submitted November 26, 2019 at 07:24PM by Arnadus

    Problem with the routing any ideas?

    controller ------------------------------------function indexController() {function getIndex(req, res) {res.render('index', {title: 'CV'})}}module.exports = indexController;route ---------------------------------------------const express = require('express');const router = express.Router();const indexController = require('../controllers/index-Controller.js');router.get('/', indexController.getIndex);module.exports = router;-----------------------------------------------------------The error i get is : Error: Route.get() requires a callback function but got a [object Undefined]

    Submitted November 26, 2019 at 05:28PM by draganov11

    NodeJS Certification Course?

    Does anyone know a good place to study for the new NodeJS Certification? Is there a course out there that is tailored to this certification?https://openjsf.org/certification/

    Submitted November 26, 2019 at 04:23PM by the-impostor

    Make Illegal States Unrepresentable! - Domain-Driven Design w/ TypeScript

    https://khalilstemmler.com/articles/typescript-domain-driven-design/make-illegal-states-unrepresentable/

    Submitted November 26, 2019 at 03:14PM by stemmlerjs

    Node.js performance issue?

    I was making some benchmarks on Node.js and I found something interesting: a potential performance issue.Try running this piece of code with Node (do not try to run it on the browser since it seems there are no problems with javascript on the browser):function benchmark(nrOfTimesToRun, fn) { const startTime = +new Date(); for (let i = 0; i < nrOfTimesToRun; i++) { fn(); } return +new Date - startTime; } class Property{ static get(target) { return target[this.KEY]; } } class NameProperty extends Property{} NameProperty.KEY = 'name'; class RoleProperty extends Property{} RoleProperty.KEY = 'role'; class User {} var user = new User NameProperty.get(user); // RoleProperty.get(user); const result = benchmark(1e7, () => { NameProperty.get(user); }); console.log('Execution time: %d ms', result); In my case, Node completed the task in `77 ms`. Now uncomment the `RoleProperty.get(user);` line and run the code again.BOOM. My pc finished the task in `1162 ms`.​What is the problem here? Why it is taking so slow to run the benchmark in the second case?​Debugging this I found that `return target[this.KEY];` might be the problem. More exactly `this.KEY`. I think Node has a hard time getting the static property.​Is this a known problem of Node?

    Submitted November 26, 2019 at 02:31PM by IonelLupu

    Testing async function with mocha

    My code looks like this ::var expect = require('chai').expect;var should = require('chai').should;var _ = require("lodash");function asyncTask(){setTimeout(function(){console.log("After 2 seconds");},2000);}describe("Test", function(){it('Test Async', function(done){asyncTask();done();});})The output of the following code is :::Test✓ Test Async​​1 passing (6ms)​After 2 secondsAs you can see after 2 seconds is being printed after test has been passed but if I need to do some validation from the returned result from asyncTask how do I do that? Test should be passed after async call is complete. Is there any way to acheive this?

    Submitted November 26, 2019 at 02:32PM by GhostFoxGod

    A lighter V8

    https://v8.dev/blog/v8-lite

    Submitted November 26, 2019 at 10:55AM by fagnerbrack

    Error when uploading in file

    NPM - alternative install directory (node_modules)

    I am currently stuck with a problem: I am creating a build task (using Grunt), and got a task that builds the product into a dist/ directory. I therefore want to run npm install --only=production in that directory, in order to strip off "junk" not needed in node_modules.What I have tried:Using an npm-command in Gruntfile, with this config:'npm-command': {npmInstallDist: {cwd: "./dist/",cmd: "install",args: ["--only=production"]}},This does not work, it seems like it ignores the cwd completely, and do the work in the root node_modules folder.I then tried to add a script in package.json:"scripts": {"buildDist": "cd dist && npm install --only=production"}This does not work either, not sure exactly why. It still remains in the root directory when installing.So, I'm stuck. The only solutions I can see from the top of my head, is eitherCreate an install.js, that uses node chdir() and spawn() or similarCreate a function in Gruntfile that does the same

    Submitted November 26, 2019 at 11:32AM by oyvindi

    Lets build an image resizing microservice using NodeJS and ReactJS #1

    https://youtu.be/19VAq5KGf8k

    Submitted November 26, 2019 at 09:01AM by pitops

    Trying to read an event "tree" pre order

    Show image

    I get a random name from the array but at the time of displaying the images it fails and it puts me that it is not a file or directory, the js file is in the same folder as the images to prevent me from getting the name with the path, in another version that I have with the route if I get both the image and the corresponding name but with the route as well and I want to avoid showing that route, I have already avoided it with the extension but I don't know what else to try.-- 1st version (js in the same folder where the images)const Discord = require("discord.js");const config = require("../config.json");const colours = require("../colours.json");const window = require("window");const randomFile = require('random-file');const path = require('path');const fs = require('fs');module.exports.run = async(client, message, args) => {const randomimg = ["Aegiochusmon Blue.jpg","Aegiochusmon Dark.jpg","Aegiochusmon Green.jpg","Aegiochusmon Holy.jpg","Aegiochusmon.jpg","Aegisdramon.jpg","AeroVeedramon.jpg","Agumon (2006 anime).jpg","Agumon Burst Mode.png","Agumon Expert.jpg","Agumon X.jpg","Agumon.png","Agunimon.jpg","Aircraft Carrier Whamon.jpg","Airdramon.jpg","Akatorimon.jpg","Aldamon.jpg","Allomon.jpg","Allomon X.jpg","Alphamon.jpg","Alphamon Ouryuken.jpg","Amon.jpg","AncientBeetlemon.jpg","AncientGarurumon.jpg","AncientGreymon.jpg","AncientKazemon.jpg","AncientMegatheriummon.jpg","AncientMermaidmon.jpg","AncientSphinxmon.jpg","AncientTroiamon.jpg","AncientVolcanomon.jpg","AncientWisemon.jpg","Andromon.jpg","Angemon.jpg","Angewomon X.jpg","Angewomon.jpg"]const img = randomimg[Math.floor(Math.random() * randomimg.length - 1 + 1)]message.channel.send({file: img})message.channel.send("El digimon es: " + img.replace(/\.[^.$]+$/, ''));}module.exports.config = {name: "digimons",usage: "-digimons",aliases: ["dig", "digimdesc"]}In this case it shows me the name without the path or extension (just as I would like) but does not show the image.​-- 2nd version (js on a different route from where the images are)const Discord = require("discord.js");const config = require("../config.json");const colours = require("../colours.json");const window = require("window");const randomFile = require('random-file');const path = require('path');const fs = require('fs');module.exports.run = async(client, message, args) => {const randomimg = ["./Digimons/Aegiochusmon Blue.jpg","./Digimons/Aegiochusmon Dark.jpg","./Digimons/Aegiochusmon Green.jpg","./Digimons/Aegiochusmon Holy.jpg","./Digimons/Aegiochusmon.jpg","./Digimons/Aegisdramon.jpg""./Digimons/AeroVeedramon.jpg","./Digimons/Agumon (2006 anime).jpg","./Digimons/Agumon Burst Mode.png","./Digimons/Agumon Expert.jpg","./Digimons/Agumon X.jpg","./Digimons/Agumon.png","./Digimons/Agunimon.jpg","./Digimons/Aircraft Carrier Whamon.jpg","./Digimons/Airdramon.jpg","./Digimons/Akatorimon.jpg","./Digimons/Aldamon.jpg","./Digimons/Allomon.jpg","./Digimons/Allomon X.jpg","./Digimons/Alphamon.jpg","./Digimons/Alphamon Ouryuken.jpg","./Digimons/Amon.jpg","./Digimons/AncientBeetlemon.jpg","./Digimons/AncientGarurumon.jpg","./Digimons/AncientGreymon.jpg","./Digimons/AncientKazemon.jpg","./Digimons/AncientMegatheriummon.jpg","./Digimons/AncientMermaidmon.jpg","./Digimons/AncientSphinxmon.jpg","./Digimons/AncientTroiamon.jpg","./Digimons/AncientVolcanomon.jpg","./Digimons/AncientWisemon.jpg","./Digimons/Andromon.jpg","./Digimons/Angemon.jpg","./Digimons/Angewomon X.jpg","./Digimons/Angewomon.jpg"]const img = randomimg[Math.floor(Math.random() * randomimg.length - 1 + 1)]message.channel.send({ file: img })message.channel.send("El digimon es: " + img.replace(/\.[^.$]+$/, ''));}module.exports.config = {name: "digimon",usage: "-digimon",aliases: ["di", "digidesc"]}In this case it shows me the image and the file name but I want to somehow remove the path.

    Submitted November 26, 2019 at 07:45AM by Racconccity

    Monday 25 November 2019

    Udemy Courses

    Hi guys I'm triyng to learn NodeJs and found this 2 popular nodeJs course on udemy was wondering if anyone had took this course before and how was it? Or are there any other better courses out there? Would be better if its free.https://www.udemy.com/course/nodejs-api-masterclass/https://www.udemy.com/course/the-complete-nodejs-developer-course-2/

    Submitted November 26, 2019 at 03:36AM by dexstm1988

    How Do I Send a post request after a double Click ?

    As the title says:Say I have an image tag (see below)​
    As you can see above I've set ondblclick to myfunction.2 put a link to my script in the head.I want to trigger my function on double clicking the image, that function will then call an app.post() method in my server file.​So in summary I want the double click to trigger my client side js file function which will then trigger a method on my server side js file in order to send the post request. Can someone please tell me what I'm doing wrong :P. Thanks.

    Submitted November 26, 2019 at 05:05AM by bodymindsoul

    Join a new edition of the best JS survey

    https://survey.stateofjs.com/

    Submitted November 26, 2019 at 05:25AM by kap89

    For past month, i've been trying to improve my code and overall architecture of my applications. But i can not find any good repository, which shows how tests are done well.

    So, I have been learning nodejs here and there for past year, progressed really far in my opinion, and i am also starting a job in a week as a node developer, but about month ago, i found out that almost everything i did, was kind of wrong. my whole code structure and "practices" were based of some of udemy courses out there, until i found out Bulletproof nodejs repo and article accosiated with it. i immediately started to migrate my personal projects to this kind of setup and honestly, i really liked it. I liked typescript, i liked separation of everything, etc, etc. but one thing i always did wrong was my testing i guess. or, should i say, i almost never did testing. but as i am going to start work, and i will be in a completely different environment, i want to learn how to write good tests, which are following same bulletproof structure and actually test for "everything". my main work will be to write mostly webpage apis and if you guys will be able to link me to some well-tested api repos, i will be happy. thanks in advance

    Submitted November 26, 2019 at 06:22AM by warchild4l

    console.log() ghost?

    I have a application level middleware in my express app, which deals with all the errors processing. The problem is sometimes, I just cannot console.log() the error even though the program runs well. The below is the code: /* Global error handling */ app.use(async (err, req, res, next) => { console.log(err); //Ghost... const messages = [] const buttons = replyButtons("", ["Create Ticket", "Email Team", "Phone Call"], [], false) const list = replyList(`Error Message : ${err.message}`, "https://i.ibb.co/cyz5vBT/404-error.png", "", buttons) messages.push(list) await sendMessages.post(req.cid, messages) return res.status(500).send(err.message) }) Thanks!

    Submitted November 26, 2019 at 04:59AM by PanJohn2019

    Authorization

    I am rather a beginner in express.js and would like to add some authorization to my web app. I know passport.js handles authentication, so what are some beginner friendly strategies to accomplish authorization?

    Submitted November 26, 2019 at 03:15AM by keeperpaige

    Framework or no framework

    I was hoping to get some opinions on this.I am building an application that I hope to be successful - who knows. My question is, when is it a good idea to use a framework (loopback/nest) in Node vs. just spinning up an API from scratch?What are the pros and cons of using a framework vs. building your own api?

    Submitted November 26, 2019 at 01:02AM by Patek_Daux

    Node.js CI with Tekton Pipelines

    https://medium.com/@francisvitullo/node-js-ci-with-tekton-pipelines-15381e7034c6?source=friends_link&sk=bfd27550dc9786be8ff6f0f436d22fe3

    Submitted November 25, 2019 at 09:40PM by wineandcode

    Trying to get a simple NLP.js example working - any ideas ?

    What are your go-to middleware when you use Express, and why?

    No text found

    Submitted November 25, 2019 at 07:24PM by RundownDuck

    Native C/C++ module support for free-to-use low.js, = Node.JS on microcontrollers, + low.js community forum!

    https://www.neonious.com/Blog/index.php/2019/11/25/low-js-native-api-and-low-js-forum/

    Submitted November 25, 2019 at 05:05PM by neoniousTR

    Node.js app runs fine locally but i can't reach it with a public address

    I have posted the following question on stack overflow and I'm here for more answers !I'am trying to reach a node.js test app on web but it doesn't work. For now it's just a simple node.js app that grab an html page and show it, it's work on local and on my server which run on debian buster.const express= require('express'); const app=express(); app.use(express.static(__dirname)); app.get('/',function(req,res){ res.send(index.html);}) app.listen(80,"0.0.0.0",function(){ console.log('Running helloWorld on 80') }) the netstatWhen I enter the ip in the research field i got athis site can’t be reached err_connection_timed_outInternet box ports are open & I've stop nftables so it's not the problem.Thank you for your time :)

    Submitted November 25, 2019 at 04:02PM by pilum_Mu

    How to change base URL

    Announcing core Node.js support for ECMAScript modules

    https://medium.com/@nodejs/announcing-core-node-js-support-for-ecmascript-modules-c5d6dc29b663

    Submitted November 25, 2019 at 03:27PM by by_value

    Node.js Passport Authentication | Login and Register Example Using Express Flash Messages

    https://youtu.be/wV6Z2cP7o3s

    Submitted November 25, 2019 at 02:25PM by coderchrome123456

    Traffic from Facebook hanging?

    I have a nodejs app that hosts a few projects/websites that I work on. If I put a link on FB it never loads the website. It works fine with direct link but never from any posts on Facebook.I dont know if it has anything to do with the tracking stuff they add to the url "/?fbclid= XXXXXX"I tried adding router.param to my code but makes no difference? How do I route traffic from facebook?

    Submitted November 25, 2019 at 01:52PM by poorly_timed_leg0las

    Rate Limiting in Node.js

    https://medium.com/@forbeslindesay/rate-limiting-a0783293026a

    Submitted November 25, 2019 at 12:50PM by ForbesLindesay

    How to write test cases for express routes?

    Hi, I have an express route like this :app.get('api", firstStep, secondStep, thirdStep);function firstStep(req,res,next) {//some async worknext();}Now I want to write unit test case for only firstStep and secondStep. The problem is how do I tell mocha/chai to wait for async task to being finished and how do I tell it that after firstStep is done it needs to go on secondStep.

    Submitted November 25, 2019 at 01:18PM by GhostFoxGod

    Free node hosting.

    Hello everybody,Do you guys know any good and free NODE hosting? I tried heroku, glitch, zeit now and even tried to find a really small VPS. What to do if I just want to host my own discord bot?

    Submitted November 25, 2019 at 01:05PM by 18gatenmaker6

    Beamery are hiring for Senior Backend Node.JS Engineers to build our next generation architecture

    https://pages.beamery.com/hub/vacancy/ev18h1KUI

    Submitted November 25, 2019 at 12:11PM by adamrabinovitch

    Sunday 24 November 2019

    Looking for feedback on this approach for deploying monorepos to AWS with CircleCI, anyone else having similar problems?

    https://medium.com/volta-charging/dipping-into-monorepos-with-yarn-workspaces-and-circleci-570da427a9ec

    Submitted November 24, 2019 at 10:47PM by cazzer548

    Lightweight fullstack with TypeScript

    First, I can be considered as a novice Node developer, as my experience with has been sporadic in the past.I'm working on an app, where I'm implementing the backend in TypeScript. This is actually an Electron app (shouldn't make any difference), with an additional admin interface that can be accessed remotely.As a lot of datatypes are shared with the backend (REST), I figured it would be a good idea to use TypeScript for the admin page as well.This would be a light weight page, using Bootstrap. What I haven't figured out 100% yet, is how to put this together. I got a separate tsconfig for the adminpage. Dependencies such as Bootstrap, jQuery (required by Bootstrap) are added with NPM.Then what ? Do I need a bundler, like Webpack ?

    Submitted November 24, 2019 at 11:01PM by oyvindi

    Can no longer access local website via iOS home screen icon after a few hours of server uptime

    I'm dealing with some strange behaviour and I was hoping someone could lead me into the right direction.In Safari, I went to my local web app which is just 192.168.1.30:4500 and added the website to my home screen.Like the title says, when the local express server has been running for quite some time; I am no longer able to access the website through the icon on my home screen, it just says "Safari cannot connect to... or something". BUT I am able to connect to the web app completely fine via Safari directly at all times, just as long as the server is up.I can't really show any code but I was hoping if someone can tell me what's going on. Also I think it's important to note that I do not want any caching to occur since it's a live web application which constantly get's updated with the server.P.s. the web app is a create-react-app.I'm sorry if this doesn't belong here, please remove the post if so. I just thought this might have something to do with node or express.

    Submitted November 24, 2019 at 09:18PM by Crispy_Kleina

    am trying to make a discord.js bot which will search a txt file for a word and then output a bit of info related to the input word

    I am trying to make a discord.js bot which will search a txt file for a word and then output a bit of info related to the word but have been trying for a few days with no hope.

    Submitted November 24, 2019 at 09:22PM by SaltyMini

    electron-builder help wanted

    Hi all,I am looking for what I would assume would be a very simple solution, but I am not seeing anything about this in the electron-builder documentation.I am using TravisCI to deploy builds of my electron app to GitHub, however the Linux build also wants to push to the SnapStore. How can I have it ONLY publish to GitHub? I do not want to publish to the SnapStore until my app is in a more usable state. My build settings in the package.json is as follows:"build": { "appId": "com.openrpg.app", "productName": "OpenRPG", "copyright": "Copyright © 2019 ${author}", "publish": { "provider": "github", "owner": "incomingstick", "repo": "OpenRPG-App" } },Any help would be appreciated!

    Submitted November 24, 2019 at 08:13PM by incomingstick

    share my node modules folder

    I shared my node_modules folder with a developer should I not have done that? I'm using node with Vue

    Submitted November 24, 2019 at 07:33PM by notfirsttime

    How to Consume Remote Restful API's in Node js Using Request Library

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

    Submitted November 24, 2019 at 05:31PM by coderchrome123456

    Node.js Multiple Image Upload Using Multer Express and EJS

    https://youtu.be/eQC-VZEl0eU

    Submitted November 24, 2019 at 07:54AM by coderchrome123456

    Saturday 23 November 2019

    should Real time fps/mmo like games using socket.io/TCP/ or Websocket server type of architecture have direct access to sql? yay nay

    should we separate it with different server via api calls?but also using redis for throw away later data

    Submitted November 24, 2019 at 01:56AM by cariaga123

    Design patterns in NodeJS

    https://medium.com/@alonso.oliverio/design-patterns-in-nodejs-990fed17c49c?source=friends_link&sk=ff9e391455983386d13b0e685deaa6ec

    Submitted November 23, 2019 at 08:11PM by kiarash-irandoust

    Express/MongoDB Encryption Question

    So I am building a Google Drive clone just as my first learner project, and the core functionality is working, but i would like to encrypt the files i store in mongoDB (using gridfs for large file sizes). I have been hearing about using the crypto module to do this (I want to continue to use read/write streams), which of course requires a cipher from a key. So i'm not sure exactly what to use as a key, and more importantly where to store it, I was thinking of using the hashed password stored in the mongoDB user model, but what would stop someone from just opening mongoDB (with something like compass on the machine), getting that hashed password, and then using it to decrypt the grid.fs data? Then I was thinking of just using some master key to encrypt all of the file data, but that key would need to be stored somewhere on the local machine obviously, so i'd just run into the same issue if someone got there hands on the server and went through the files.I've heard something about mongoDB having an option to encrypt all the data, but is this only for enterprise users? Wouldn't i still need to store the key somewhere, and how bad would the performance decrease be from encrypting everything?Idealing I would like to encrypt just the chunks that grid.fs creates, and avoid encrypting the whole mongoDB database (or even my disk).Small side note, wouldn't full disk encryption not be the beneficial? It's only beneficial if the machine gets turned off, but if the machine remains on, couldn't they get all the data just like a non-encrypted disk?Sorry I know this is a lot of questions, just kinda lost right now.

    Submitted November 23, 2019 at 05:11PM by subnub99

    Unsure how to approach my Node API's architecture for a single page application

    Hey everyone.I've written some very basic CRUD SPAs in the past, but it's been a while since I've gotten back in the Node.js land. I committed myself to making something "full-stack" using React, Node, and MySQL for the database. It will still definitely be a CRUD application, but I also want to dive into using some cloud services like Azure for content moderation (just for experience working with another service), as well as implement OAuth OpenID Connect for user authentication. This is stuff I've never tried in my prior CRUD apps.I want to approach this project more seriously than I used to when I was an extreme newbie, so this time around, I'd really like to design my application a bit better.This had led me down some rabbit holes, and I'm not sure if I'm spinning wheels or truly going somewhere. As a specialized front-end dev (and truly only having worked with SPAs), I'm not sure what a good approach is for architecting my Node API.I've found some articles on some patterns, such as the clean architecture, but I'm really not sure if this is something I should be worrying about?I think I am looking for a sense of direction. I have admittedly never thought about API architecture, and I feel like I am really struggling. Any advice or guidance towards the proper resources would be greatly appreciated.TL;DR: As a front-end developer, I know JavaScript, but now want to design an API in Node for my personal project (CRUD app). I want to use a nice architecture for the Node project, but don't know if it's worth spinning my wheels researching best practices.

    Submitted November 23, 2019 at 05:39PM by FungoGolf

    Node.js | Hapi.js & MongoDB | Create a Restful API Using Mongoose and Joi

    https://youtu.be/QyLkPyojz3o

    Submitted November 23, 2019 at 04:50PM by coderchrome123456

    I’m just gonna our this out here

    NodeJS is so damn cool. Like cmon people, it’s just sooo awesome!!! I’m really exited about it and yeah from the tone of this you probably guessed, I’m quite the beginner but oh boy aren’t I excited.

    Submitted November 23, 2019 at 03:46PM by flopygooftop

    I wrote an article about getting started with TypeScript for Node

    https://medium.com/@bartwijnants/getting-started-with-typescript-for-node-50679fa596e

    Submitted November 23, 2019 at 03:34PM by WPMusicFinder

    A good, free tool for log visualization?

    I'm using winston to log in an app at the moment but I'd also like a tool which can provide a more visual output, especially for non devs, for what's going on. Google hasn't been much help as it seems there are a lot of logging services which have written lots of blogs to muddy the waters on searching for free tools.I'm hoping there is one decent tool that can be downloaded, hooked up to a database and run without paying $50 to $100 a month. Anyone?

    Submitted November 23, 2019 at 02:57PM by blindly_running

    Node.js Library to Get Youtube Video Id from Url

    https://youtu.be/lwGA_O9vpk0

    Submitted November 23, 2019 at 10:39AM by coderchrome123456

    [Beginner] How to create a Blog App where only selected persons can post?

    I am a beginner who is doing Colt Steele's Course(not finished yet). I have made a basic Blog site where anyone can make an account and start posting articles.For a project, I want to create a blog site where only selected persons can post articles. I was recommended by some to check out "Admin panels", which looked a bit complicated (which I will look further into ofc, if its the best option).Another basic solution that I was suggested was to not create a registration page altogether, so people can not register. Only the selected persons who should be able to post, their accounts would be created via manual MongoDB entry creation. There would be a login page where only those selected persons would be able to log in.the second option makes sense, the only downside being that it will look very strange to have a Login button, but no Register /Sign Up button. Still, I like this because of the simplicity.Any suggestions? Thanks.

    Submitted November 23, 2019 at 11:02AM by NecroDeity

    Proxy question

    I am working on a backend express application and connecting the front end (react to this express backend)- I would like to have a proxy on the front end so that I can just make requests to the backend end points like thisfetch('/api/users').then(response => response.json()however, the proxy is set to set up correctly and poiting to port 5000 like this"proxy":"https://localhost:5000" # client package.json fileMy question is when I am now making requests on my front end to endpoints "/api/users" (which are stored in the backend ) I get a status of 500 Internal Server error. But when I change this request end point from "/api/users/ tofetch('https://localhost:5000/api/users').then(response => response.json()I am able to get the users from the backend. Any ideas why this is failing ?From my understanding my proxy is set up well and fine.Thank you.

    Submitted November 23, 2019 at 11:57AM by FemiJodz

    Lisk enables JS developers to create side-chains from scratch in a easy-peasy way. Is this the JS Wordpress equivalent of blockchains?

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

    Submitted November 23, 2019 at 12:23PM by carbonara_delegate

    Node.js Library for Generating Hashes of Objects and Arrays

    https://youtu.be/jadlGfujdkg

    Submitted November 23, 2019 at 08:55AM by coderchrome123456

    Compile 10+ version for x32 ununtu

    I know that node stopped supports linux x32 distros but can i compile now newest version of node for my xubuntu x32 from source code ?

    Submitted November 23, 2019 at 09:23AM by Sergogovich

    Friday 22 November 2019

    Simple Node.js Library to Convert Markdown Files to PDF

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

    Submitted November 23, 2019 at 07:05AM by coderchrome123456

    Simple Node.js URL Validation Library

    https://youtu.be/rsDCCFNucu4

    Submitted November 23, 2019 at 05:55AM by coderchrome123456

    Image Processing in Node.js Using Jimp Library

    https://www.youtube.com/watch?v=8KAinJD8TSQ

    Submitted November 23, 2019 at 04:16AM by coderchrome123456

    Can anybody help on how to perform an action on queried MySQL IDs?

    Thanks for reading. I currently have an Express server connected to a MySQL database and I would like to perform queried and for each row it finds, I would like to modify one or more of the variables. Below I will post two of my current snippets, one which finds all, and one which finds by id. Could somebody modify these codes to show how to change a variable or two in each (name them whatever).// FETCH all schools exports.findAll = (req, res) => { models.schools.findAll().then(school => { // Send all schools to Client res.send(school); }).catch(err => { res.status(500).send("Error -> " + err); }) }; // Find a school by id exports.findById = (req, res) => { models.schools.findById(req.params.id).then(school => { res.send(school); }).catch(err => { res.status(500).send("Error -> " + err); }) }; Also, sorry but I just thought of another question. Is there a way to do an array to the MySQL table so say at a set interval I grab a reading and put it into a table and pop off the oldest number? Say I want to store the last 10 numbers added to continuously without storing more than those 10?​Thanks for your help in advance. I know these are probably easy questions for some of you but they've been really bogging my progress down and I'm not finding what I'm looking for online.

    Submitted November 23, 2019 at 03:57AM by mrcandyman

    System service advice needed

    I want to create a systemd node service that does the following:monitors system resourcesmakes GET requests to websites (rest, rss)logs to filesends me an email when conditions are metstays awake and detects events (forever)What is the best method to start building it in an infinite loop? Is setInterval and polling every X seconds the only way to do so?

    Submitted November 23, 2019 at 03:49AM by tonystarkco

    in express, recommended way to set arbitrary data on request object?

    I have a middleware that derives some data and needs to be available to downstream handlers. Right now I am just setting that data directly on the request object. Is this an ok practice, or is there another recommended way?

    Submitted November 23, 2019 at 03:02AM by wagonn

    CMS for NodeJS applications

    Is there a CMS that can integrate with an already built Node JS server and MongoDB? All the other CMSs create their own server which requires me to add content types however I want something that uses my own models and routes in my node server.

    Submitted November 23, 2019 at 01:14AM by mr_amed

    How to send array of objects to an AWS S3 bucket using NodeJS?.

    Sorry if this post does not belongs here but can you guys please help me with this task?:https://stackoverflow.com/questions/58991531/how-to-upload-files-to-amazon-aws3-with-nodejs/I'm trying to uploads image files to an AWS S3 bucket but I've been unable to accomplish this for two days already!.Right now is just a NodeJS backend that will be added to a MERN application once is completely done.As of now, I'm using postman and I'm sending the URL images from Internet as strings to a MongoDB collection.Would I send them as string as well, when the files are being uploaded from X form in the React application that I will eventually create?NOTE: Yes, I would like to handle the uploads on the back end.Anyone has any idea on how to do this?

    Submitted November 23, 2019 at 01:04AM by kirasiris

    Is there a cookbook for scaling Node.js applications?

    I have a few techniques and tips in mind. One of them is using worker threads for computation intensive methods. Another is using database to sort your results. Another one is forking your master process and create Worker processes so you can respond to more requests. Do you have any other tip or technique? Please share.

    Submitted November 22, 2019 at 11:52PM by jesusscript

    Just wanted to say thanks!

    Been trying to learn by doing for the past week or so, and I'm having lots of fun!Except when I get stuck for hours.I've posted here twice the last couple of days, and have gotten 23 comments on those two posts. In both cases, the response was incredibly fast and also very helpful. I'd thank the individuals, but it seems to me like a lot of people here deserve thanks.Not sure how you feel about posts like this around here. I certainly wouldn't feel offended if this got removed. But for those who see this, thank you very much for helping make this one of the friendliest, most helpful online communities I've come across in a long time. Really makes me wanna continue learning Node.That's all!

    Submitted November 23, 2019 at 12:07AM by BillGoats

    Is there a cookbook for scaling Node.js application?

    I have a few techniques and tips and mind. One of them is using worker threads for computation intensive methods. Another is using database to sort your results. Another one is forking your master process and create Worker threads so you can respond to more requests. Do you have any other tip or technique? Please share.

    Submitted November 22, 2019 at 11:17PM by jesusscript

    When to Use a Private Constructor | TypeScript OOP

    https://khalilstemmler.com/blogs/typescript/when-to-use-a-private-constructor/

    Submitted November 22, 2019 at 07:20PM by stemmlerjs

    Node.js Images toPdf Module to Convert Multiple Images into One PDF File

    https://youtu.be/_Yk7coHRmZg

    Submitted November 22, 2019 at 06:17PM by coderchrome123456

    How would you go about this: 1) User interacts with front-end. 2) Back-end performs some tasks accordingly. 3) Notify user when response is ready.

    I'm working on a web application where users can perform a "search" by filling out and submitting a form. The back-end will then use Puppeteer to pull some data from another website*. During testing, I've found that this fetching of data typically takes between 5 and 10 seconds.Now, when the data is ready I would like to notify the client somehow. I've been considering Socket.io but I'm still not 100% sure that's the best tool for the job.As things are, submitting a search will:Redirect the user to a page called "My searches" that basically gives them their search history (searches and results) and allows them to interact with it.Store the search in a database (MongoDB).Run Puppeteer to fetch "search results".Store the search results in a database, with a column "searchId" referencing the search.Now, I'd like to expand this so that after step 4, the user is notified. I have a few relevant scenarios in mind here:The user is still logged in and on the "My searches" page.The user is still logged in but navigated away from "My searches".The user has logged out.Regardless of the above - the user is also logged in on another device.I'd like to handle all of these scenarios. For scenario #1 it'd be nice if I was also able to update the UI directly (but in some way that makes it obvious that it happened).For the other scenarios, I'm thinking maybe I should implement navbar notifications? For that I guess I should probably store notifications in a database as well.Nonetheless - I still don't have any better ideas than Socket.io. And even then, I've never worked with Socket.io so I'm not 100% sure how to securely and relibably tie socket IDs to individual users. (Multiple socket IDs in the case of simultaneous sessions on multiple devices.)Is Socket.io the way to go here? Any other ideas?*I'm using Puppeteer rather than web requests because the website requires a login and some kind of MFA that I've been able to automate only with Puppeteer so far.

    Submitted November 22, 2019 at 05:51PM by BillGoats

    kafka producer / consumers

    my entire team is developing Kafka producers and consumers using .net core hosted onprem k8. I'm wanting to do a similar implementation using Node as a learning exercise. and then compare to the .net core solution. Should I even bother? Any tips? Your experiences?

    Submitted November 22, 2019 at 05:29PM by superfake123

    Handle Audio Streaming from GridFS / Express

    Hello, everyone. I have created an express route that allows me to retrieve an audio file stored in MongoDB via GridFS. The problem is to be able to consume this endpoint api. On the client side, when I try to retrieve the file via the HTML tag

    📦 odc - Update npm dependencies easily!

    https://github.com/xxczaki/odc

    Submitted November 22, 2019 at 04:35PM by xxczaki

    A simple way to open password-protected .zip files in Node.js without spawning/forking child processes.

    https://gosink.in/node-js-how-to-open-password-protected-zip-file/

    Submitted November 22, 2019 at 03:39PM by apalshah

    NSQ Tutorial: Build a simple message queue using NSQ

    https://medium.com/@vladguleaev/nsq-tutorial-build-a-simple-message-queue-using-nsq-1ae1a279dfab

    Submitted November 22, 2019 at 12:45PM by EvoNext

    Node.js Capture Chrome Library to Take Screenshots of Website Using Google Chrome

    https://youtu.be/rt8-V5TRdPg

    Submitted November 22, 2019 at 11:32AM by coderchrome123456

    Combining objects help needed

    People in stackoverflow recommended to post it on reddit: https://stackoverflow.com/questions/58966177/merge-n-object-from-array-into-one-array-based-on-id

    Submitted November 22, 2019 at 07:42AM by pleplooo

    Thursday 21 November 2019

    Yarn monorepo conditional wsrun with ytools

    https://github.com/devshorts/ytools

    Submitted November 22, 2019 at 01:55AM by monumentshorts

    Node v13.2.0 (Current) | Node.js - with unflagged ESM support !!

    https://nodejs.org/en/blog/release/v13.2.0/

    Submitted November 21, 2019 at 11:33PM by TomEnom

    How do you avoid blocking the event loop?

    Let's say you have to sort a large array of users. How do you insure that it won't block the event loop used to respond to HTTP requests?function sortUsersByAge(users) { users.sort(function(a, b) { return a.age < b.age ? -1 : 1 }) } Do you have to send requests for sorting the arrays to a new Node.js server and then asynchronously wait for the result? Or is there a better way? What are some solutions including the less optimal ones?

    Submitted November 21, 2019 at 09:02PM by jesusscript

    Preserve setTimeout between process exits

    I want to have a notification dispatched to some users at some point in the future, when a poll posted by them on my platform has ended. There can be multiple of those polls and multiple users can be indulged in them. So when the poll is created, I can use setTimeout to notify users at the expiry date of the poll that I obtain from the users. But the issue is that the node process often restarts because of frequent changes I do to the code, and I have to re build it.. Once the process is quit, setTimeout is also lost. So how do I preserve setTimeouts between process exits? In this case using setTimeout is obviously not the solution, but then what could be the way out of this problem? I could store this notification in some db and have a cron job run every so often, but is there any other, more elegant solution?

    Submitted November 21, 2019 at 06:28PM by abhi12299

    PDFKit Node.js Library to Generate PDF Files on the Server Side in Javascript

    https://youtu.be/BVmdVe9uDrs

    Submitted November 21, 2019 at 06:16PM by coderchrome123456

    What are some useful use cases for setImmediate and nextTick in Node.js?

    I never ever used them in a Node.js application. It might be due to the fact I only built RESTFUL APIs with Node.js, but I am wondering if there's any good use case for it and in what kind of applications these two are the most often used.

    Submitted November 21, 2019 at 05:19PM by jesusscript

    genius-lyrics-api

    A package that provides a convenient wrapper around Genius API for searching and scraping song lyrics.Source: https://github.com/farshed/genius-lyrics-api

    Submitted November 21, 2019 at 05:23PM by felixatwood

    Learn how to build decentralized applications on æternity with Milen Radkov Take at WeAreDevelopers Vienna

    https://www.wearedevelopers.com/events/congress-vienna/workshops/

    Submitted November 21, 2019 at 04:07PM by sinonimboga

    Stacktraces on promises fairly useless

    Is your custom callbacks really asynchronous?

    A quick read on async and sync callbacks https://medium.com/@sujeshthekkepatt/is-your-custom-callbacks-are-really-asynchronous-cf05747ebde7?source=friends_link&sk=dfa93fe0617556075e9b514592e2ec2f

    Submitted November 21, 2019 at 02:49PM by sujesht

    Interview Question: What are some common causes of memory leaks in Node? How might you detect and address them?

    Hey all,New-ish dev here. I recently went on an interview where I was asked "What are some common causes of memory leaks in Node? How might you address them?" I thought this was a really good interview question and I hadn't been asked it before.I'd appreciate any feedback on my response.Forgetting to unregister event listeners.Objects, global or otherwise, that are being referenced multiple times and aren't being garbage collectedClosures could be maintaining references to large objects.[this is all I could think of on the spot]"I haven't yet dealt with a memory leak problem but I would try to get some preliminary data. Ideally, we would be using PM2 or some other process monitoring tool in production for monitoring/logging and gather some metrics and insights. Is memory growing sharply or gradually over time? Is there one particular process or is it spread across multiple? If this is an API server, is there a particular offending endpoint?To further isolate the issue we can use node inspector and do some snapshot comparisons. Trigger a garbage collection to start from a clean state, then initiate a snapshot. Once we are finished profiling, we can do a comparison of the heap before and after. We can then use the inspector to drill into which objects seem to maintaining the largest size. If there is a clear offender, we can go back to the code and see if we can remediate the memory leak. We repeat the same process to test if we were successful."Anything else I might be missing or that I could improve upon?

    Submitted November 21, 2019 at 02:56PM by brodega

    Crawler | Node.js Library to Web Scrape Title of any Website

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

    Submitted November 21, 2019 at 03:12PM by coderchrome123456

    I was looking for a Node.js job position and I was surprised to find out in interviews that Node.js is not used at it's full potential

    Hello Internet,So recently I started looking for a new job as a full stack developer with Node.js on backend. I went to 7 interviews so far and every company was using Node.js just as a middleware for they microservice architecture (the other services were built using mostly Java and PHP).Honestly, I was expecting them to use Node.js to build bigger apps, like those apps from their microservice architecture.Why isn't Node.js used at this scale and why it's used as a glue technology?Of course, there may be companies that use Node.js for big apps but 7 out of 7 companies i was interviwed for used Node.js jusy as a glue piece.Is it because the frameworks available don't provide enterprise level features out of the box?

    Submitted November 21, 2019 at 02:11PM by IonelLupu

    FileSaver.js Basic Tutorial to Save or Download a File in Javascript

    https://www.youtube.com/watch?v=kwfoEb0-DQI

    Submitted November 21, 2019 at 01:27PM by coderchrome123456

    sequelize include with where issues

    Hello, I'm searching the 1:N table for the condition of the N table.I want to get all the value for that 1-table (if i have information on the n-table)But I don't know how to do that.... (help!)​Below is the way I tried.​https://preview.redd.it/yjrevvmpi0041.png?width=874&format=png&auto=webp&s=96a770fba8c82d54b3300d9baaa8182bead24bf8Result:​https://preview.redd.it/cdvvwburi0041.png?width=838&format=png&auto=webp&s=eca0e678d58523376b840100b664041e139b1ffb​But I want to get the following results, not the above ones.What i want it:​https://preview.redd.it/q6wtal2ui0041.png?width=774&format=png&auto=webp&s=e8a4701de29e129f8a53afdb31f15771fba42eb1​Is there anyone who can advise me?Thank you for reading.

    Submitted November 21, 2019 at 09:55AM by alphaca1

    Rails setup for node?

    Hi, im a beginner with node and have some experience with rails.​Is there any good nodejs solution to have a scaffold build like with rails? I dont want to build everything my self, it is good enough when it just works! :DRails gems are great. Is there a nodejs version of gems? Im aware of npm but with gems you also get a ui with some gems......

    Submitted November 21, 2019 at 10:19AM by sljmn

    Learn how to build Amazon website using Vue.js and Node.js

    https://coursetto.com/course/learn-how-to-build-amazon-website-using-vuejs-and-nodejs/

    Submitted November 21, 2019 at 10:26AM by cioranique

    [ASK] What's the deployment flow for fullstack on AWS?

    Hi! A beginner here.How do I deploy Express (Apollo-server-express) back-end and Next.js front-end apps on AWS?Should I use EC2 or Beanstalk's Docker or Node app?I found 2 ways from googling;https://www.youtube.com/watch?v=fIeIzHMC4BQhttps://www.freecodecamp.org/news/production-fullstack-react-express/But I'm not sure which one is legit.Please help me.​Backend: TypeScript, Apollo-server-express, Knex.js, Postgres, RedisFrontend: TypeScript, Next.js

    Submitted November 21, 2019 at 11:24AM by xzenuu

    Project based learning for Node.js

    https://github.com/tuvtran/project-based-learning/blob/master/README.md#node

    Submitted November 21, 2019 at 11:15AM by jesusscript

    Build Secure Node.js REST API Using JSON Web Token (JWT)

    https://codesquery.com/build-secure-nodejs-rest-api-using-json-web-token/

    Submitted November 21, 2019 at 07:36AM by hisachincq

    Wednesday 20 November 2019

    Make R&D DevTeam's CLI DevTools Using NodeJS

    A cli tool to generate cli tool scaffold out of the box!https://github.com/imnemo/pudding-cli

    Submitted November 21, 2019 at 07:02AM by oncoding

    Express-Mongoose-MongoDB Question

    Hello everyone, I am building some back-end services for a photography portfolio React app I am working on and would like to optimize my DB a bit more. Right now I have several documents, each with a container array, in a single collection that store image objects. Unfortunately, I am a bit new to Express/Mongoose so I was wondering what the code would look like for me to save a document into a completely separate collection, in the same DB, based off the genre of the image object that is send from the React client. Furthermore, I am also curious what the code would be to access a specific collection and then find an image object by id. Please note, that the ultimate goal here is to segregate image objects based off their genre so, for example, there would be an aerial collection that simply stores image documents. This method of storage would greatly simplify my current solution AND remove the need for me to store images within a container document's array.For reference, I am building all of my routes and async helper functions in a routing module that gets imported as middleware in the main app.js file. For reference, here is the Github for my source code: https://github.com/bryantb2/photographyReactApp/tree/master/server​Seriously, thanks a ton to anybody that can help with this!

    Submitted November 21, 2019 at 07:08AM by DELGODO7

    How to Read Data from a PostgreSQL Database using JS, Node.JS, Express.JS, and pg-promise

    Hey guys I was trying to figure out how to connect to a database and read data from it in a web app for a while and I finally figured it out and made a video walking you through the process. Hopefully this saves someone starting out some time and points them in the right directions. Feedback would be much appreciated.https://youtu.be/7D0x79lLevs

    Submitted November 21, 2019 at 05:18AM by Sweet_Bonnie_Brown

    Express Route Tester

    https://www.outpan.com/app/d2458c8285/express-route-tester

    Submitted November 21, 2019 at 12:54AM by mitousa

    Need help testing social login on nodeJS

    Hi... This is my first time posting here. I recently started learning nodeJS as my first JavaScript framework and I'm working on a group project in which I'm supposed to implement testing for everything I do. I worked on signing in with Facebook and Google using passport jwt and u got it working but I don't kniw how to test it, considering the login features and api calls. I tried to use stubs with Sinon but I couldn't go far before I got stuck again. I'm lagging behind and would appreciate some pointers om how to go about this. What else should I stub? How do I bypass the authentication code and all?Currently my app goes from /auth/facebook to the Facebook log in site which asks for permission, after this, a json message with user token as well as profile is sent back as a response, same with google.I would really appreciate responses

    Submitted November 21, 2019 at 12:34AM by D3ST1NU

    Mongoose: Model1.Find, then for each result set attribute to Model2.Find, THEN render. How?

    I'm trying to wrap my head around this but having some troubles.Basically, I'm first fetching "Search" objects, and then need to fetch "SearchResult" objects using SearchResult.find({searchId: search._id}, function(err, results) { ... });. I'm trying to set it up with callbacks, which for now looks something like this:function retrieveSearches() { searches = []; Search.find({}).sort('-_id').exec(function(err, searches) { if (err) { console.log(err); } callback(searches); }); } function retrieveSearchResults(searches) { search.results = []; searches.forEach(function(search) { SearchResult.find({searchId: search._id}, function(err, results) { if (err) { console.log(err); } else { search.results = results; } }); }) callback(searches); } retrieveSearches(function(searches) { retrieveSearchResults(searches, function(searchesWithResults) { res.render('profile', { title: 'Mine søk', searches: searchesWithResults }); }); }); Of course, retrieveSearchResults won't work because the callback is called before the forEach loop is done. I just don't see how I can loop through an array of objects and perform a single query on each and every one of them, use the result for something and then render.Any ideas?

    Submitted November 20, 2019 at 09:41PM by BillGoats

    Can anyone help about this installer problem ?

    How can I fix this problem ?https://preview.redd.it/hloikdb9gwz31.png?width=1920&format=png&auto=webp&s=e13e92cde75952fcd9e377fdeba197c77cc99598

    Submitted November 20, 2019 at 08:18PM by RorschachPrime

    Ask Reddit: What's your favorite http client request library?

    This year I've been using got for new projects, but it does not have the kind of debugging capabilities I am used to in request. Request is the most popular, but it is also in maintenance mode and the maintainers believe users should transition to other libraries (https://github.com/request/request/issues/3142).I took the alternative libraries table and extended it with other attributes I thought important when considering alternatives. Here's that table:​Attempting to \"score\" http client request librariesMy question to the Reddit community is, which is your current favorite http client library and why? Perhaps I'll create a top comment for each package, and folks can vote on their favorite and comment why. If you have one not on this list, feel free to add it to the top comment list!

    Submitted November 20, 2019 at 07:17PM by Rebles

    What are some interview questions you would ask to a self-proclaimed senior Node.js developers?

    I feel I can learn a lot of this from this question. That's why I am asking it.

    Submitted November 20, 2019 at 05:40PM by jesusscript

    Leveraging NodeJS to access Revolut from a computer using electron

    https://github.com/Annihil/revolut-emergency

    Submitted November 20, 2019 at 05:06PM by Ann1hil

    Who are some of the most competent Node.js developers on Github?

    I want to learn from the best and in order to do so, I need to look at their codes. Who are some of the most competent Node.js developers on Github?

    Submitted November 20, 2019 at 05:39PM by jesusscript

    Introducing progressive content hydration - A design pattern

    https://softwareontheroad.com/on-demand-content-hydration/

    Submitted November 20, 2019 at 04:47PM by santypk4

    No more API validation code: express-openapi-validator auto-validates requests, responses, and securities for OpenAPI 3 and ExpressJs

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

    Submitted November 20, 2019 at 03:21PM by coracarm

    Node.js Pupeteer Web Scraping | Getting the Source Code of Website in Javascript

    https://www.youtube.com/watch?v=6R9H_P0qeNI

    Submitted November 20, 2019 at 04:30PM by coderchrome123456

    A Simple Express JWT API Boilerplate

    Whilst working on other projects, I usually found myself having to write user login/signup logic so I created a boilerplate to speed things up. I made this one with simplicity in mind as a lot of API Boilerplates for user management seemed too complex for my use cases.The boilerplate is well documented on the Github Repo for anyone interested in using it. Authentication is done with JWT through headers (See postman example in docs).Any feedback is welcome :)Express JWT API Boilerplate

    Submitted November 20, 2019 at 12:49PM by DMDxv

    NodeJS C++ client node-firebird-libfbclient v.0.1.4 released with fixes for current node versions

    https://www.npmjs.com/package/firebird/v/0.1.4

    Submitted November 20, 2019 at 10:05AM by mariuz

    Node.js Pupeteer Web Scraping | Taking PDF of any Website in Javascript

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

    Submitted November 20, 2019 at 10:00AM by coderchrome123456

    Node.js Pupeteer Web Scraping | Capturing Screenshots of Website in Javascript

    https://www.youtube.com/watch?v=4ClkvZh_0ZQ

    Submitted November 20, 2019 at 09:07AM by coderchrome123456

    Yoni Goldberg - What's new in Node.js testing

    https://youtu.be/y9Y7bQnxYQY

    Submitted November 20, 2019 at 09:26AM by yonatannn

    Build a Server-less Application using AWS Lambda Functions with Netlify

    https://medium.com/@abdamin/build-a-server-less-application-using-aws-lambda-functions-with-netlify-525b8326ce77?source=friends_link&sk=779e07a02f4c3a69d311236dd38c5738

    Submitted November 20, 2019 at 09:27AM by kiarash-irandoust

    TypeORM - Relation with property path ** in entity was not found

    (see https://www.reddit.com/r/learnjavascript/comments/dy287f/typeorm_relation_with_property_path_projectrole/ for more in-depth explanation )I am struggling with joining from my projectsParticipants model. The thing that is unique about this model is that it uses field resolvers instead of @ManyToOne relations in the resolver itself.```@Field(() => projectsRoles)async projectRole(@Root() projectRole: projectsRoles) {return await projectsRoles.findOne({project_role_id: projectRole.project_role_id});}```When trying to join contacts or projectsRoles into projectsParticipants, I get an error when trying to select columns from the models I've joined. My "contact" column is also having problems. The thing that is unique about my contact column is that it has a composite primary key, so the field looks like this:```@Field(() => contacts, { nullable: true })async contactPerson(@Root() contact: contacts) {return await contacts.findOne({contact_id: this.contact_person_id,company_id: contact.company_id});}```

    Submitted November 20, 2019 at 08:36AM by Xarnius

    Tuesday 19 November 2019

    Free Open Source Portfolio For Every Developer 🚀

    https://www.reddit.com/r/github/comments/dygw0a/free_open_source_portfolio_for_every_developer/

    Submitted November 20, 2019 at 06:51AM by saad-pasta

    What is the best/simplest method for sending notifications to your phone?

    I would like to set up automatic notifcations or SMS to my phone whenever my server runs into an error, or any other notification-worthy uses. My NodeJS application is running on my home computer and not running on my phone.Nexmo and Twilio look like the top commercial ways.

    Submitted November 20, 2019 at 05:15AM by HanSoloCupFiller

    Great introduction to using Socket.io in Node.js

    https://socket.io/get-started/chat/

    Submitted November 20, 2019 at 04:01AM by KeepBitcoinFree_org

    Pika.dev

    A new package registry https://www.pika.dev/registry

    Submitted November 20, 2019 at 03:44AM by sujesht

    Build A Linearly Scalable Decentralized Messaging Application in Node.js With Shardus

    https://shardus.gitlab.io/docs/developer/main-concepts/building-a-poc-app/building-a-poc-app.html

    Submitted November 20, 2019 at 01:30AM by dreamchasing13

    How would I get a the name property of a form using Nodejs?

    I can’t really find any answers to this question on stackoverflow, but I was wondering if their is a way to get the name property of the form using Nodejs? I’m using also using the express framework.

    Submitted November 20, 2019 at 12:42AM by Anuraj2000

    WeTransfer-like API for sending big files as email

    Hello guys, I am building an app which needs to send a file as email attachment.The problem is, this file can't be send directly with nodemailer because it can be quite large (>100mb). I tried using WeTransfer API but it keeps crashing my app by using almost 2GB of RAM whenever the WeTransfer API is called. (My app only used 100mb of RAM when processing the file)Any suggestions or alternatives?Thanks in advance :)

    Submitted November 19, 2019 at 11:30PM by basswietse

    Today i released first public version of dnscrypt - authenticated and encrypted DNS client for nodejs. It is pretty stable but do not have tests yet.

    https://github.com/reklatsmasters/dnscrypt

    Submitted November 19, 2019 at 09:21PM by dtsvet

    Full-Stack Web Dev Crash Course: Coding a SaaS App in Node.js

    https://youtu.be/HmyMFZQDWyU

    Submitted November 19, 2019 at 09:07PM by voidupdate

    Node.js article for working with the Stream API

    Hello everyone. I posted my first article on medium. It is about working with the Streams in Node.js.https://medium.com/florence-development/working-with-node-js-stream-api-60c12437a1bePlease let me know what you think. I hope some of you will find it helpful!

    Submitted November 19, 2019 at 03:24PM by DarkMaann

    How to split database models with SoC (separation of concerns) in mind?

    Usually, a model should address a specific range of functions. For instance, the userModel addresses only things specific to a user. Nevertheless, when translated into code, does that mean that in the userModel, only queries to the users table is allowed?Allow me to illustrate this by an exemple. We have 3 tables like so:``` -- users id, email, password-- groups id, name-- users_groups_ownership user_id, group_id ```A user can belong to one or more groups, so for each group a user belongs to, there is an entry in the users_groups_ownership table.Whenever we want to get all the groups that a user belongs to, that's a job for userModel because we'll use a join from userModel.Now, if we need to add the user to a group, it would be an insert on the users_groups_ownership table, so should this be a dedicated model? Or inserting this table should be considered part of the userModel?I often find myself stuck in this kind of situation, not being sure if the structure is good or not. And I couldn't find any clear ressource on the matter.

    Submitted November 19, 2019 at 06:43PM by Buzut

    React and electron

    I have recently started creating apps with nodejs and electron. I've had my eye on react as it would dramatically reduce my workload.Only one problem: I can't find any good, working and up to date tutorials anywhere.I am aware that there is an official boilerplate but it looks unnecessarily complex for my use case and I would also like to become familiar with how the whole system works and this provides an opportunity.

    Submitted November 19, 2019 at 03:28PM by Administrator101

    GraphQL resources needed.

    Hi everyone! What are the best resources out there to learn graphql.?

    Submitted November 19, 2019 at 03:41PM by lostavenger286

    What are the most difficult features you had to implement as a Node.js developer?

    I am asking, because it might give me an idea of what to learn next.

    Submitted November 19, 2019 at 01:54PM by jesusscript

    Best way to track the number of views of a page

    I'm currently working on building a website using keystonejs and I would.like to track the number of views on the blog page. What is the best approach to do so?

    Submitted November 19, 2019 at 01:00PM by PearllyO

    Book recommendations for advanced Node topics, which are up-to-date?

    No text found

    Submitted November 19, 2019 at 12:42PM by warchild4l

    jscasts ep15 - TDD - building a bulletproof JavaScript API Clients with nock

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

    Submitted November 19, 2019 at 11:21AM by hotcto

    Node v12.13.1 (LTS)

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

    Submitted November 19, 2019 at 11:54AM by dwaxe