Tuesday 31 December 2019

Holy shit

sqlite3 is the worst fucking library of all time

Submitted January 01, 2020 at 05:07AM by ufuw

What's the perfect architecture for a Node.js application using Express.js and GraphQL?

I've made an application using Express.js and GraphQL, but I was thinking of refactoring it, because I just put most of the backend code in a file called server.js. I am wondering if there's any good example on Github that shows you how I should refactor it.

Submitted January 01, 2020 at 04:38AM by jesusscript

Use Global Node Modules in Normal Nodejs App/Script

https://stackfame.com/nodejs-require-global-node-modules

Submitted January 01, 2020 at 04:44AM by vithalreddy

Making the switch => object Pattern Work in TypeScript

https://maxburson.com/switch-object-pattern-with-typescript/

Submitted January 01, 2020 at 04:29AM by fagnerbrack

Have you used Codementor? What do you think of it? Would you use it again?

/r/AskProgramming/comments/ei945o/have_you_used_codementor_what_do_you_think_of_it/

Submitted December 31, 2019 at 09:28PM by JamieCorkhill

Open-source YouTube alternative that also supports audio and images, powered by NodeJS

https://github.com/mayeaux/nodetube/

Submitted December 31, 2019 at 07:46PM by meddit_app

CORS blocked using insomnia or postman, why?

Hello guys, i'm using POSTMAN to make a request on my serve but it is been blocked by cors. Does someone knows how to solve this? doesnt make sense cuz postman is not a browser. the origin it is been undefinedThis is my code: ts private middlewares (): void { this.express.use(express.json()) const whiteList = ['http://127.0.0.1:8020', 'http://localhost:5000'] const corsOptions = { origin: (origin, callback) => { if (!!origin && whiteList.indexOf(origin) !== -1) { callback(null, true) } else { callback(new Error('Not allowed by CORS')) } } } this.express.use(cors(corsOptions)) }

Submitted December 31, 2019 at 07:29PM by danilosilvadev

Creating a REST API with Express.js and MongoDB

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

Submitted December 31, 2019 at 05:52PM by pmz

npm manablox-cli - a zero config webpack runner

Hi there, i am just working on a javascript ecosystem.First step... a modern cli tool :)so, the manablox-cli, a zero conf webpack runner tool is ready to test :)https://www.npmjs.com/package/manablox-cliplease let me know, what you think about it :)

Submitted December 31, 2019 at 04:14PM by daspete555

help updating mongoose subdocument

HelloI need help updating a subdocument in mongoose and sometimes I struggle with Mongoose Documentation. I am using the most recent version v5.8.3.To give this context, I am building an app that tracks personal 1 rep max at the gym. In MongoDB I have a 'personrecords' document that look like:_id: ObjectId("5e05f6e065300b3154798773")user_id:"5e05f6e065300b3154798772"lifts: Array0: Object_id: ObjectId("5e05f7e8af6d963c6829b2c2 ")name: "Test Lift"type: "lift"preDefined: falsedate: "12/31/19"comment: "This is a test comment"personalRecord: "100 lbs"1: Object2: Objectcardio:Arrayskills:ArrayI want my user to be able to edit/update an entry.So far I have been able to access the specific entry I want to update. Below is the code (hard coding my variables for now):router.put('/:id', async (req, res) => {try {let movement = 'lifts'let id = "5e05f6e065300b3154798772"let prID = "5e05f7e8af6d963c6829b2c2"let record = await PersonalRecord.findOne({ user_id: id})console.log(record)if(movement === 'lifts'){let lift = record.lifts.id(prID)console.log(lift) // gives me the right subdocument.. but now what?   } } catch (error) {res.send(error);    }})Once I have the correct subdocument, how do I update one or all of the object key/value pairs?Lets say I want to change the 'personalRecord' and the 'comment'.​Any help would be appreciated, thanks!

Submitted December 31, 2019 at 01:29PM by la712

Can somebody help me to use Quill JS with my API ?

I looked all websites about quill with databases. I couldn't find how to use it. I used Express, Mongoose, BodyParser. Can somebody write an example code ?

Submitted December 31, 2019 at 09:28AM by Varenberg

NHipster generator to create full stack app in nodejs server part and angular/react client

I want to share an useful project, spin-off of jhipster, that allow you to generate an app with security, entities from a model, for the server part (using NestJS framework like angular pattern) and client part (choosing angular or react). It is already published in npm registry, and if you want to contribute refers to: https://github.com/jhipster/generator-jhipster-nodejs .Any feedbacks and issues are welcome!

Submitted December 31, 2019 at 08:26AM by amanganiello90

Monday 30 December 2019

Get real-time Flight status and global Aviation data with Laravel/PHP/Node.js for free!

https://learninglaravel.net/get-real-time-flight-status-and-global-aviation-data-with-laravelphpnodejs-for-free

Submitted December 31, 2019 at 06:57AM by peterbixa

Why I don't use koa ?

1. Wrong middleware modelNormally middlewares should be linear, but koa is stacked.koa also introduced the side effect that every express middleware be rewrite due to its fault.2. Wrong encapsulationNormally if client programmers can easily send the final response, middlewares will have no chance to change the body or get the body.but koa processes the final body passed by the middlewares through the ctx object,every middleware can get the final processed body and modify it,which introduces a very severe security problem.This means every middleware can steal the final processed content and further more change it with out notice.The following link is an example showing where koa is wrong and why it is insecure in Chinese.https://www.youtube.com/watch?v=nofVl7eoSz4

Submitted December 31, 2019 at 06:59AM by calidion

Why do I have to use pg or express to use Node.js with Postgres?

I'm new to node.js and I've recently taken on the challenge to set up my own web server using it. However, I can't find a single tutorial that doesn't mention pg or express or something similar. So I'm just wondering, is it possible to hook up node.js and Postgres without using any other frameworks and is there anything stopping me from creating my own framework?

Submitted December 31, 2019 at 07:06AM by rafad900

Can someone please help me understand ioc-container and service providers from adonisjs documentation?

I am going through the adonisjs docs and I understand almost everything but when I stumbled upon ioc containers and service providers. I just couldnt understand any of it. Please help, thank you.

Submitted December 31, 2019 at 03:37AM by ajirnanashak

When to move from MySQL to Mongo?

I've been using MySQL for all of my projects, and every time I tell myself, "I should really learn Mongo some day".From what I understand the main advantage to Mongo is scalability, particularly running multiple instances on several machines. Are there any other major benefits that I'm missing?

Submitted December 31, 2019 at 02:00AM by Intellectual-Madman

Filtering relations with TypeOrm

anyone knows how I filter relations with typeorm?const currentUser = await User.findOne( { email: user.email }, { relations: ['items'] } );Now let's say I only want items with status "available", how would I filter this?

Submitted December 31, 2019 at 02:07AM by roconf

KoaJS - Validating & Docs

Hey guys,what's the best option to validate user input? And what's the easiest way to document my API?I read about some koajs-swagger plugins but they are all kinda inactive. Any advice?

Submitted December 31, 2019 at 12:53AM by roconf

Security

Is there any github repo/tutorials/blogs that follow the best practices on how to make complicated user roles? Not just by showing to store roles as a string in an array..

Submitted December 30, 2019 at 09:46PM by j_abd

So how fast is Node with Mongo actually?

I'm wondering where are the bottlenecks and what kind of response time can we expect from talking to a MongoDB over a Node.js server.The thing is, I was quite mind blown by the single-query response times from the front-end to the backend-into the DB and back to the frontend. It's literally milliseconds, and that just blows my mind.That being the main idea, I understand how the Event Loop works and that if you write async calls in your server-DB interface, you should have a pretty stress free operation. Including optimizing your queries with .lean() and a strictly typed model structure when does Mongo start to lag? With thousands of concurrent DB queries, memory and CPU start to bottleneck, but at what point does that happen? What about the server? What kind of numbers start to take a toll on the server? I take it, it takes more to slow down the server than it does the database.Just thinking about things, preparing for scenarios where production apps get more traffic or a sudden spike. If you want to boast a little you can share your experience of how you tackled such events with this environment. Keep it simple, though. I love a good challenge. JavaScript rocks and I am so glad to be ridden of the former web-server infrastructure. Apache,nginx, bleeeeh...

Submitted December 30, 2019 at 09:59PM by sunny_lts

2019 in a summary - GraphQL perspective

https://blog.graphqleditor.com/2019-summary-for-graphql/

Submitted December 30, 2019 at 08:41PM by oczekkk

Auth for multiple users with Node and Passport-JWT?

So I can make a MERN stack CRUD app w/Passport-JWT and have all users login/logout and post/delete items. None of the videos or tutorials I've found seem to cover anything much more complex. I have a list application and I'd like users to only be able to see/update their own lists, rather than everyone going to the same place. Questions:What is a good way to set this up/write it in Node (and/or React)?Do I have to also create a Profile or Account schema or can it be done with just a User schema?Is MongoDB a better or worse choice here than a SQL db? Should I use Sequelize instead of Mongoose?General best practices?If anyone has code samples or references, feel free to post them or DM me.

Submitted December 30, 2019 at 07:49PM by anewdialect0

Contact Us Form Using Angular Material

https://w3hubs.com/contact-us-form-using-angular-material/

Submitted December 30, 2019 at 06:13PM by w3hubs

Common Javascript Promise mistakes every beginner should know and avoid

https://gosink.in/common-javascript-promise-mistakes-beginners/

Submitted December 30, 2019 at 05:14PM by apalshah

Node Modules quick Concepts...

https://www.tutorialslogic.com/node-js/modules?latest

Submitted December 30, 2019 at 02:09PM by ukmsoft

CLI Tool to create universal boilerplates - any feedback appreciated!

https://git.io/JeAqs

Submitted December 30, 2019 at 12:14PM by eyk_

Very Beginner Problem (My Node server is not responding...)

Nodejs script to download pictures from unsplash.com and use them as wallpapers

Hi friends! I'm looking for a node.js script on github that will download new wallpapers based on the search words I enter, but I can't find it anymore. Can anyone help me out?Thanks!Best regards!Stefan Pirker

Submitted December 30, 2019 at 11:22AM by stefanpirker

Does anyone know how to load image data in node.js?

I am coming from python. Reading an image in python gives a list of pixels for that image. How do I replicate this functionality in node.js / javascript?

Submitted December 30, 2019 at 10:25AM by Pager07

Need feedback on my Node.js TESTING course before I publish

I'm working on a comprehensive course about modern Node.js testing. It contains all the basics for beginners + chapters which are way beyond the basics like component testing, testing in production, testing with DB, property-based testing and 10 others.I'd like to have a preview group that gets the lessons for free and provides feedback. Want to join and get 10 hours of advanced testing material? PM me and I'll be glad to join youHow can you know if my content is satisfactory? check out my guide on testing here, this is the level of content you should expect for:https://github.com/goldbergyoni/javascript-testing-best-practices

Submitted December 30, 2019 at 10:26AM by yonatannn

Sunday 29 December 2019

GTTS (Google Text-to-Speech) file won't download after deployment

I've tried several different methods with no luck. I posted in a thread that was posted on how to use the package, but it was from too far back to get a response. Here it is, again. $10 tip to anyone who can help with this. Neither the example provided on the github nor the example from the uploader resolve the issue.The file downloads every time, when I use localhost:3000. The file goes into my project directly, even when I specify a path to a different folder. I've deployed to two different places to resolve the issue, and it works on neither (but for different reasons)." I even redid the app with html (rather than ejs) and deployed to github (405 error). When I'm hosting it, the file downloads just as it should. When I do it via Heroku, it goes through the process as if it's working, and redirects to home (which only happens after it's successful), but no file. In the video, no download directory is given, and I read the docs and couldn't figure out how to get that to work. You're supposed to be able to use .save to specify the path and filename, I tried it many different ways and each one failed. The best I got was instead of silently download, it actually popped up in the download history. Normally, it just pops into my main directory, but this time it downloaded like any other file would in my download history, but not so when I re-deployed to Heroku.If anyone has any idea on how to specify the directory or get a prompt asking the user where to download the file, I'd be grateful. https://codeshare.io/2pVPvD (I removed res.download..made no difference, added fs and path to try out several solution that didn't work)Here it is live: https://phrasebooktts.herokuapp.com/Docs:"save(savefile) Do the TTS API request and write result to file. Parameters savefile (string) – The path and file name to save the mp3 to. Raises gTTSError – When there’s an error with the API request.write_to_fp(fp) Do the TTS API request and write bytes to a file-like object. Parameters fp (file object) – Any file-like object to write the mp3 to. "As you can see, I do not have an eye for design, I normally use bootstrap, but I'm forsaking that to get better at CSS in the next few months. Looking forward to getting started, as soon as I resolve this download issue."

Submitted December 30, 2019 at 02:09AM by JSDevNAHalfShell

[Express] Post request JSON problems

I am experiencing with a MERN project. It seemed to be working fine on another computer, but when running in my device, I face a problem when sending a post request to the API. The request I get is the following:{ '{\n "username": "Josh",\n "firstname": "Southy"\n}': '' } Where it should be:{ username: "Josh", firstname: "Southy" } Can't figure out what is happening but seems to be something related to JSON parser. I already use bodyparser on the server:app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.json()); Any advice?

Submitted December 29, 2019 at 10:29PM by aShupa

express-session `req.session.user` isn't being saved? Also, there is no sid cookie being saved?

app.use(session({ name: SESS_NAME, secret: SESS_SECRET, saveUninitialized: true, resave: false, store: new MongoStore({ mongooseConnection: connection, collection: 'session', ttl: parseInt(SESS_LIFETIME) / 1000 }), cookie: { sameSite: true, secure: NODE_ENV === 'production', maxAge: parseInt(SESS_LIFETIME), path: '/' } })) I have that already in my app.js. When I log into my app, I set req.session.user by doing req.session.user = sessionUser;. In the same function, I log req.session.user and it shows the session user. However, when I do another GET request to a test path, router.get("", (req, res) => { res.send(req.session.user); }); req.session.user is undefined? req.session exists, and so does req.session.id.

Submitted December 29, 2019 at 09:47PM by HellD

Serverless application development with Node.js on AWS platform using Serverless framework

https://medium.com//serverless-application-development-with-node-js-on-aws-platform-using-serverless-framework-63e79fcf9409?source=friends_link&sk=8806c48cb68d44e97fdee92f0dc9f886

Submitted December 29, 2019 at 09:30PM by Fewthp

Intro to Strapi (node headless CMS)

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

Submitted December 29, 2019 at 08:59PM by majesticamera

Can you hide a IFrame behind express

I have to deal with a somewhat difficult Situation. I have a docker container which exposes a webapp. The container is some kind of black box which I cannot manipulate. I would like the Webapp to only be reachable within an IFrame.I want to restrict access to the Webapp because I cannot secure it directly. I can only secure its parent (the owner of the iframe).I don't really know how I could achive this behaviour. I wonder if I could put express in front of the iframe. If the request is authorized I could forward it to the IFrame. Is something like that possible?Or do you have any other suggestions?

Submitted December 29, 2019 at 07:58PM by ll8X

Common Node.js/Javascript Promise mistakes every beginner should know and avoid

https://gosink.in/common-javascript-promise-mistakes-beginners/?utm_source=nodejs&utm_medium=reddit

Submitted December 29, 2019 at 07:28PM by apalshah

✅QA Wolf: Node library to create browser tests 10x faster

https://github.com/qawolf/qawolf

Submitted December 29, 2019 at 05:29PM by jsperl

Node Package Manager

https://www.youtube.com/watch?v=2ReQZFwFXp4

Submitted December 29, 2019 at 04:08PM by VLabStudio

html in json response

I want to return the content of an html file inside of a json response.This is what i have at the moment:fs.readFile(output_path, function(err, data) {if (err) {return res.status(400).send({              message: "There seems to be an issue with file type / file"            });    }return res.status(200).send({msg: "bla bla doesnt matter",            data: data.toString("utf8")          }); output path is the path to the html file.When i receive the json i inspect the data variable and the html is in weird format.Meaning that the html tags are wrapped in backslashes: see below ...........Because of the backslashes the html output comes out looking weird.What can i do to change this behavior?

Submitted December 29, 2019 at 03:50PM by jcoder42

Promise question

Hello everyone,recently i saw a talk about promises in js. The talk was about bad practises using Promises. I found the repo on github, which has the used examples in the talk. Now im not sure how to use promises in a loop properly, without blocking the event loop. If you have some suggestions how to improve this example code, that its not blocking the event loop to longHere is the github repo, with the examples. https://github.com/jasnell/broken-promises/tree/master/Part1/Loopsand here is the talk with the right positionhttps://youtu.be/XV-u_Ow47s0?t=1442

Submitted December 29, 2019 at 04:02PM by kliefados

Very noob question

Hello, this is a very noob question but I really hope someone can help me.Currently I just build myself a localhost server with HTML & CSS and pure Javascript.But what I need is, I want to be able to show content from my PC, in this localhost.So obviously I need a backend language for that. It's maybe also possible with vanilla JS, but I know it's not the proper solution for this.So let me give you an example, My web page (index.html) has a beautiful desing. And in header it just say: "Here is all my files in directory C://Desktop : "So, in below that header, I want to print all my filenames in my desktop. With using nodeJS.It might look like a stupid example, but I just wanted you to understand lol.I'm very beginner so this question might sound stupid too. Please enlighten me. :(Thanks in advance! and sorry for english.

Submitted December 29, 2019 at 03:32PM by Blackwater_7

I made a library called delta-intent to simplify create and update operations on models. Would love some feedback!

https://github.com/omairvaiyani/delta-intent

Submitted December 29, 2019 at 01:28PM by askmeaboutfightclub

What is your best free app monitoring and logger for node?

No text found

Submitted December 29, 2019 at 12:09PM by patilanz

Monitoring Node.js: Watch Your Event Loop Lag!

https://davidhettler.net/blog/event-loop-lag/

Submitted December 29, 2019 at 10:50AM by dhet0

How can i get POST requests from html form input file & text together?

I have a HTML form. This form has input type = "text" and input type="file" elements. Like this :
But if you want to post a file with html form , you should add this attribute to your formenctype="multipart/form-data"But if i add this , i can not get text and other fields wih body-parserSo how can i get them together ? get text field and upload an image with html form in node side

Submitted December 29, 2019 at 08:44AM by ahmetbcakici

Saturday 28 December 2019

Yarn problem?

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

Submitted December 29, 2019 at 06:04AM by Shrimp-Idler

Starting a pet project with Nuxt + Hapi: which ORMs are there and what would you recommend?

I'm starting a new project just to explore Hapi, never worked with it. I'm going to use Vue (Nuxt) and the database will be MySQL for the sake of simplicity. What would you recommend as an ORM?I am very used to the comfort of Laravel's Eloquent and I'd very much like something that gave me the same set of tools: a CLI that builds migrations, seeds, models and all of that and something well documented enough that I don't feel like I'm one of 10 people using the next best framework.

Submitted December 29, 2019 at 03:49AM by inhalingsounds

Authenticating my node app against Django

I am currently running django as a cms. My goal is to add nodejs to the mix for some real time socket fuckery.So far, I have it running like this:var djangoAuth = function (req, res, next) { jwt.verify(req.params.django_user_jwt, 'DJANGO_SECRET_KEY', function(err, decoded) { if(err) { res.status(401).json("Go away") } req.user = decoded; next(); }); } router.post('/django_login', djangoAuth, (req, res) => { console.log("Hey", req.user); }); So far it works. I just have to login to Django on the front end and POST the JWT token it spits to my nodejs backend. Does it sound like a good plan?

Submitted December 29, 2019 at 02:30AM by pink_tshirt

When you define a function in NodeJS, which object is that function a member of?

In the browsers execution environment when you define a function, that function is a member of the windowobject. For example:function myFunc() { console.log( 'hello' ); } console.log( window.myFunc ); // valid In NodeJS, we don't have a window object, be we do have a global and a module object. However, when you define a function the same way in the NodeJS execution environment, this function is not part of global object or the module object.function myFunc() { console.log( 'hello' ); } console.log( global.myFunc ); // undefined console.log( module.myFunc ); // undefined So which object is myFunc a member of?

Submitted December 29, 2019 at 12:46AM by UnknownEssence

Simple bitcoin transaction for beginners 🚀🚀

https://link.medium.com/GKBWv8tAN2

Submitted December 28, 2019 at 11:46PM by iivancabral

Thank you so much for

https://i.redd.it/0rn1bh618g741.png

Submitted December 28, 2019 at 10:15PM by ParablesBoltnoel

Thank you so much for:

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

Submitted December 28, 2019 at 10:00PM by ParablesBoltnoel

What is the best way to validate user file uploads?

How do I verify that something is a valid image, i.e png, jpeg, etc?What currently solutions are out there that everyone uses?

Submitted December 28, 2019 at 08:06PM by grumpyrumpywalrus

A simple node-i18n solution

https://github.com/calidion/node-i18n​It is a general purpose i18n solution which can be integrated with vue/angular/react or any other frameworks regardless of frontend or backend.

Submitted December 28, 2019 at 01:54PM by calidion

node-i18n based vue i18n solution

https://github.com/calidion/node-i18n-vue

Submitted December 28, 2019 at 01:58PM by calidion

Building a Telegram Bot with Node.js

https://blog.soshace.com/building-a-telegram-bot-with-node-js/

Submitted December 28, 2019 at 11:51AM by dobkin-1970

MERN STACK | PART#4 In this video, we'll create an Articles component. We gonna install the React Router library to route throughout the components. Also, we'll install the Axios library which helps us to fetch the data from MongoDB database.

https://youtu.be/BOaZUf0ey6w

Submitted December 28, 2019 at 11:29AM by andrewdovg

Has anyone ever used redux (or other state management) on the server?

I read a thing, either in docs or somewhere else (can't remember), that said you could use redux on the server. I was just wondering if anyone has done that and what they used it for.

Submitted December 28, 2019 at 11:15AM by otherMeme

Why would one use nanoexpress over just uWebSockets.js?

So I've been learning to work with regular express.js, which I've found to be more than fine for most things, however I've started looking into faster alternatives because I wanted to attempt to build a simple game server that I want to be performant even on minimal resources.My search brought me to uwebsockets.js, and then nanoexpress. So here's where I'm confused, even though uwebsockets.js has this description "Think of it as a complete replacement to both Express.js and Socket.IO, written entirely in C/C++ for maximum performance and reliability", we also have nanoexpress which is a "nano-framework powered by uwebsockets.js".So I'm wondering why anyone one would want this "thin layer" (nanoexpress) over just using uwebsockets.js if uwebsockets.js is already "a complete replacement to express.js".

Submitted December 28, 2019 at 10:40AM by lemon07r

Friday 27 December 2019

I generated YouTube HTML Tutorials video + audio completely by a bot, the channel even got decent traction!

https://www.youtube.com/channel/UCdgJpIY-mhicfIpP8skR83gDid this many years ago, came across some guy saying he made a video automatically so wanted to share thiswhat do you guys think? Should I generate other programming language tutorials :)

Submitted December 28, 2019 at 07:09AM by mypirateapp

Advice on image uploading with mern application.

Thank you all for being so generous with your time and expertise, my issue was resolved that i asked the last time.I have a question around uploading an image with a mern application. I have seen tutorials that are very simple to implement if I follow their exact approach, however my backend that is recieving the image upload is part of an endpoint that receives other user inputs from a form to and then gets posted to the server, for example car details, make, model, price and image that will all be stored in the database.My question does anyone know how to upload images when the image upload is part of other data that needs to be posted to the server too ? Will the form data work as expected when its also receiving req.body inputs like make, model, price etc ....Thank you

Submitted December 28, 2019 at 06:09AM by giordi12

How would I create a retweeter picker app?

I'm trying to create an app like this. but with more features. I know I have to use Oauth 1.0, for the sign in, but it doesn't document what you can do with the twitter user's oauth token. Also, how do you get a list of all the retweeters? This, only allows you to get up to 100 retweeters, I don't know how I can go beyond that. What is an efficient way of getting a random retweeter of a tweet with a million retweets?

Submitted December 28, 2019 at 03:44AM by HellD

Database architecture question

I am making a cooking application that makes it easy to find recipes based on ingredients you have in the kitchen. What would be the correct database and data architecture to use?Example: - I have a 100K recipes, each having 10+ ingredients - As a user, I can various ingredients (salt, pepper, pasta, etc) in my profile as I always have them. - the application should list recipes based on my set of ingredient - the application should also ‘recommend’ ingredients that ingredient would help increase the number of recipes to the user. For example, if I don’t have salt, the the app may list 10 out of 100,000 recipes. As such, it should recommend a few ingredients that would increase the list - the use may also want to see and research if he should add some ingredient to his shopping list by seeing how many additional recipes would be possible by this ingredient plus his existing ones. For example by searching ‘ground chicken’, plus his profile list of 20 ingredients, the system should list all recipes which are possible to cook

Submitted December 28, 2019 at 02:32AM by pakimon82

unit test database?

should you? if so, how should you?

Submitted December 28, 2019 at 02:49AM by superfake123

Looking for proper examples.

Hello guys,I am starting a new project and I decided to use KoaJS with TypeScript. Right now I am in the process of setting everything up and I am kinda confused by the lack of good practice examples for my usecase. Anyone got any advice for me? I am trying to add InversifyJS to be able to use dependency injection but I fail at something simple like splitting my routes into different files.

Submitted December 28, 2019 at 12:26AM by roconf

Why Event-Based Systems? | Enterprise Node.js + TypeScript

https://khalilstemmler.com/articles/enterprise-typescript-nodejs/why-event-based-systems/

Submitted December 27, 2019 at 07:07PM by stemmlerjs

What makes GraphQL what it is

https://youtu.be/vc9Q5pMXnWg

Submitted December 27, 2019 at 07:07PM by ParablesBoltnoel

Is there any good example of a Node.js Express application doing unit, integration and E2E testing perfectly?

I am thinking of doing a bunch of tests on my latest Node.js Express application, but I want to make sure I am doing everything correctly. In order to do that, a good example project would be helpful.

Submitted December 27, 2019 at 06:11PM by jesusscript

Send NodeJS app logs to Azure

linkJust wanted to share this here. You might find it useful if your using Log Analytics in Azure as logging and analytics platform.

Submitted December 27, 2019 at 06:20PM by jsantasalo

Questions about Micro services

Hey everyone!Currently working on a project for a client, currently at about 2k active users!The current code base is massive, all stuffed into one application that we want to split apart.I get the concept of building each service based on a feature or critical point... but how do you tie everything together and serve content to the actual user?Do you have one a large application that handles basically checking credentials, that then passes it off to the micro service internally?Would love your thoughts and experiences with deploying and building something like this.

Submitted December 27, 2019 at 06:32PM by grumpyrumpywalrus

Parsing array sent through express' bodyparser middleware using sequelize, express, axios and react redux

I'm having some trouble sending any array from my redux's store as form data. My back-end works using Postman to send an array, I guess I'm just having some problems connecting my front-end to it. My front-end code basically uses form input to update local state, which ideally gets sent in. This is my code below.client/src/actions/customersAction.js// Post New Customer export const postCustomer = newTable => dispatch => { axios .post("/customers", newTable) .then(res => { dispatch({ type: POST_NEW_CUSTOMERS, payload: res.data }); }) .catch(err => { alert(err.message); }); }; server/routes/customers.js // Post new customer app.post("/customers", (req, res) => { const { newTable } = req.body; const { customer_name, customer_phone } = newTable; // POST single customer if (newTable.length < 1) { db.Customers.create({ customer_name, customer_phone }) .then(customer => { console.log("> New Customer Created"); console.log(JSON.stringify(customer)); }) .catch(err => { console.log(err.message); }); } // POST more than one customer else { db.Customers.bulkCreate(newTable) .then(customers => { res.json(customers); }) .then( () =>{ console.log('> Multiple customers created.') }) .catch(err => { console.log(err.message); }); } }); /server.js (partial-code)const app = express(); const PORT = process.env.PORT || 5000; const db = require("./server/config/database"); const router = require("./server/routes/index"); app.use(express.urlencoded({ extended: true })); app.use(express.json()); app.use(cors()); app.use((req, res, next) => { res.header("Content-Type", "application/json"); next(); }); Postman example that works{ "newTable":[ { "customer_name":"name", "customer_phone":"1111111111" } ] }

Submitted December 27, 2019 at 06:57PM by kingducasse

My first Node App: A platform to create and share your workouts and browse other popular workouts! I would love any feedback.

https://www.workouthub.app/It doesn't store usernames and passwords, so you don't need to make an account. I would love for you to get in there, create some of your workouts, like some other people's workouts and criticize the hell out of the darn thing. It's completely barren right now, so fill my MongoDB Atlas up!As it stands now, it's horrible. I have some ideas in my head of how to improve it, but I historically have a lot of blind spots in my projects, so I want to see what everyone else thinks should be improved.All feedback is appreciated.

Submitted December 27, 2019 at 06:07PM by crypto_thiccboy

Locust: Distributed web data discovery and collection framework built for serverless

https://github.com/achannarasappa/locust

Submitted December 27, 2019 at 05:16PM by fireantx

Free domains deploying your NodeJS Apps

https://freedomains.dev/

Submitted December 27, 2019 at 05:55PM by songzme

(Help) How to automatically open a new tab in terminal and then run a script?

Hi,I want to run a npm script in a new terminal tab in a single command. To this purpose, I've installed ttab and wrote this script:dev: "cd back && node server", server: "ttab -t 'Server' && npm run dev" When launching npm run server , a new tab open in my terminal, as expected, but the node server starts in my original window! How to make sure the script starts in the new tab?Thanks!

Submitted December 27, 2019 at 03:00PM by MonsieurLeland

How to change directory with package.json scripts

Hi,I would like to create a simple command in package.json/scripts in order to change directory in my terminal, and start a node server. So far I have to launch the app, open a new tab in my terminal, change directory and finally launch the server.I've written: "scripts": { "server": "cd back && node server" } Writing yarn server doesn't cause any issue in the terminal, but the working directory never changes. I am still at the project's root. How can I fix this?

Submitted December 27, 2019 at 02:24PM by MonsieurLeland

Advice on mern authentication application

I am building a full stack application using the mern stack. This application is required to allow users to register and login and once they are logged in the users should be able to view and add information to their profile only. My backend is working great and i am using jwt to check who is logged in and then that allows me to post as that user only which is great.In my front end though i am able to login and sign up as specific users and it connects to the backend well, the only issue/question i am having here is when the users login they should be able to create their own car data so every car will have their own user assigned to it( in my backend i connected both user and car schema well and every car has an id) that is how i know who owns what car.My question is i want to fetch all the cars from the database and display them ( thinking this would work well but have not done it this way) vs having an additional localstorage item which then contains the token of the logged in user and another one that will contain the logged in users newly created cars ( this request gets sent to the back end either way and creates a new car from my backend end point ) i am using local storage here to keep track of the current users cars.What is the best way i can link the current users newly created car because right now local storages like a good approach.Thank you in advance

Submitted December 27, 2019 at 08:38AM by giordi12

express-imgwiz: Resize, format images on-the-fly middleware for expressjs

https://github.com/hieunc229/express-imgwiz

Submitted December 27, 2019 at 08:05AM by hieunc

Develop a full-stack webapp using NodeJS and deploy on Heroku

https://medium.com/swlh/develop-a-full-stack-webapp-using-nodejs-and-deploy-on-heroku-52c7a69a0022

Submitted December 27, 2019 at 07:36AM by beanB23

NodeJs, vueJs deploy in Heroku problem

https://i.redd.it/c1z0qbmoo4741.jpg

Submitted December 27, 2019 at 07:27AM by samvelian

Thursday 26 December 2019

Login Form In Pug

https://w3hubs.com/login-form-in-pug

Submitted December 27, 2019 at 03:35AM by w3hubs

NPM lockfiles can be a security blindspot for injecting malicious modules in PRs

https://snyk.io/blog/why-npm-lockfiles-can-be-a-security-blindspot-for-injecting-malicious-modules/

Submitted December 26, 2019 at 11:57PM by alwayslunch

Does sequelize transaction locking prevent a row from being accessed at all?

So let's say I have a user table tied to a media storage table. Every time a user uploads a video I want their user id to be attached to a row in the media table. Also say that it takes an arbitrarily long amount of time to remove a user. Lets say 15s for examples sake. If a user hits upload at 5s of the 15s run and the server has already started the process to remove the user, will a query to see if the user exists still be true? Does transaction locking apply to the whole table?The same for creating a user. Let's say I create a test to run 2 user creations in parallel and by some fluke the test generates the same username for both (assuming it should be unique). While I can place a check in the create user route to see if a user with that username already exists, 2 calls running close enough would both return true. Yes, I can add a constraint to the table to prevent non-unique usernames, but I'd much rather throw my own error, than let the call get all the way to the database before throwing an error.Is there a way to "lock" the whole user db table so when a user transaction is happening any call to the table must wait for it to finish?OR am I thinking of locks and transactions completely wrong?I was thinking of using a status column as I know sequelize allows for row locks, but I wasn't sure about the situation described above.

Submitted December 27, 2019 at 02:59AM by blindly_running

What is best database organization?

I want to be able to do something like:var success = await registerUser(user)var exists = await userExists(user)...What is best organization to do it? Where to save my function and my database connection?Right now I have one file called database.js with the MySQL connection and other file called controller.js with the functions that uses the database pool. Is important to have them asynchronous and independent.Any suggestions or examples?

Submitted December 26, 2019 at 11:27PM by patilanz

Evaluating JavaScript code via import()

https://2ality.com/2019/10/eval-via-import.html

Submitted December 26, 2019 at 09:24PM by fagnerbrack

A discord bot which gives information about file extensions

https://github.com/ahmetbcakici/fileinfo-bot

Submitted December 26, 2019 at 10:52PM by ahmetbcakici

Has anyone tried this Jonas Schmedtmann Udemy course?

Hi, I've been learning from Jonas Schmedtmann's courses on CSS, HTML and JS on udemy and they've been great.He also has a course for node.js and was wondering what people think about it since it seems less popular than the others. I'm debating whether to go with this course or the more well known Andrew Meads course.https://www.udemy.com/course/nodejs-express-mongodb-bootcamp/Thanks for any help.

Submitted December 26, 2019 at 09:34PM by bradypp

What are your thoughts about 'newman' library?

newman is a library which basically runs your exported postman collection from your cli. would it be a good way to do integration tests for apis, instead of using something like supertest?

Submitted December 26, 2019 at 07:04PM by warchild4l

Any Node build ideas?

Im Beginner to intermediate. Im look to for ideas to build in node.js that are intermediate to advance. I dont care how tough it is as long as it doesnt require a team or costs money. I want to do something that can push my limites but so far i have no clue what to build other than a discord bot which i have done and isnt too hard currently for me

Submitted December 26, 2019 at 06:46PM by lonlygamerx

🔴 No Passport.js - Node.js API Authentication with Typescript 👍

https://www.ninjadevcorner.com/2019/12/no-passportjs-nodejs-rest-api-authentication-with-typescript.html

Submitted December 26, 2019 at 05:07PM by speedzed

Node and AWS Lambda Help

I'm trying to use AWS Lambda and Node to write items to a DynamoDB table. I can hard-code the values I want to see with no problem but I can't quite figure out how to see anything when I'm writing to my front-end which is in React. But I get a 200 success message when looking at the network.I broadly adapted from this tutorial.Here's my function in Lambda:​const AWS = require('aws-sdk'); const docClient = new AWS.DynamoDB.DocumentClient({region: "us-east-1"}); exports.handler = (event, context, callback) => { console.log("Processing..."); const params = { Item: { Corpus_Name: [], Source_Name: [] }, TableName: "corpusTest" }; const response = { statusCode: 200, headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': true, }, body: JSON.stringify('Item Added'), }; docClient.put(params, function(err, data) { if(err){ callback(err, null); } else { callback(null, data); } }) }; With the const Params I can hard code whatever I want but I can't figure out what to put to tell it to actually take in what I type in my web-form.Here's my form.js in React:​import React, { Component } from 'react'; import axios from 'axios'; export default class Form extends Component { constructor(props) { super(props); this.state = { Corpus_Name: '', Source_Name: '', }; this.handleSubmit = this.handleSubmit.bind(this); this.handleCorpusChange = this.handleCorpusChange.bind(this); this.handleSourceChange = this.handleSourceChange.bind(this); } handleCorpusChange = (event) => { this.setState({ Corpus_Name: event.target.value }); } handleSourceChange = (event) => { this.setState({ Source_Name: event.target.value }); } async handleSubmit(event) { event.preventDefault(); const { Corpus_Name, Source_Name } = this.state; await axios.post( 'https://15ix4rukfb.execute-api.us-east-1.amazonaws.com/default/serverlessAppFunction', { key1: `${Corpus_Name}, key2: ${Source_Name}` } ); } render() { return (
); } } Corpus_Name is my partition Key and Source_Name is my sort key if that helps.

Submitted December 26, 2019 at 03:51PM by madmoneymcgee

aex: 0.4.0 released!

Simplified websocket support enabled.repo:https://github.com/calidion/aex

Submitted December 26, 2019 at 03:37PM by calidion

Behind the scenes: GitHub vulnerability alerts

https://github.blog/2019-12-11-behind-the-scenes-github-vulnerability-alerts/

Submitted December 26, 2019 at 03:14PM by dobkin-1970

Creating a logging middleware in Expressjs - CodeSource.io

https://codesource.io/creating-a-logging-middleware-in-expressjs/

Submitted December 26, 2019 at 02:31PM by deven_rathore

`npm update ` does not update package as expected--any ideas why?

Hi all. If I run 'npm outdated', it indicates one of my node packages (stylelint) is outdated--I have version 11.1.1 and the latest version is 12.0.1. When I run the command npm update stylelint, there is no change--I seem to still have version 11.1.1 installed (screenshot). Any ideas why that is occurring? There is no output in the console.My package.json file for the project contains: "devDependencies": { "stylelint": "^11.1.1", } Doesn't that mean the package should update to any version greater than 11.1.1?Maybe the issue has something to do with this being a major update (i.e. from v11.x to v12.0)?Just prior to this, I was able to update some other outdated npm packages in the same project, using the same processThanks in advance.

Submitted December 26, 2019 at 12:58PM by cag8f

PostgresSql

I am trying to query a postgresSql server via my WebApp, using pg.When iam compiling however it always throws several errors, because it cant find the modules 'fs', 'net', 'pg-native' and 'tls'. As far as i understood this is because i am querying from a Browser where these modules cant be used.However i found a way to mock the 'dns' module because it is not beeing used.Can i do something like this with the other modules as well or are they beeing used?Also if this doesnt work do i need to set up a server to which i connect when running the webapp and query from there, or can i circument that?If this is not possible are there any good tutorials that not only show some code that works, but also explains the how's and why's?​Thanks in advance

Submitted December 26, 2019 at 12:38PM by ma____x

Top 10 Advantages Node.js Provides to E-commerce Industry : Best Tool to Build an eCommerce Website

https://medium.com/@nisha.vaghela/top-10-advantages-node-js-provides-to-e-commerce-industry-best-tool-to-build-an-ecommerce-website-a34578615bea

Submitted December 26, 2019 at 12:39PM by freelancerkatie

How do I test file uploads using chai, chai-http, mocha?

I'm using express, mongoose, cloudinary, multer to set everything up but whenever I run tests, I get a server error (500) because the file I'm uploading doesn't exist. Everything works so I don't think this is a middleware issue - when I test with postman, I get the correct errors and correct return statements.routerrouter.post('/', upload.single('image'), (req, res) => { // stuff goes here } testingit('should add a new POST', function() { return chai.request(app) .post('/posts') .type('form') .field('text', 'text') .attach('image', './test/test_image.JPG', 'test_image.JPG') .then(function(res) { expect(res).to.have.status(200); }) }) I'm also testing what happens when required fields are missing but I can't even get this test to pass :/

Submitted December 26, 2019 at 11:30AM by RadiantImplement7

Here's what you can do with node.js crawler and Google Auto Email.

https://medium.com/@salahudinmalik/heres-what-you-can-do-with-node-js-crawler-and-google-auto-email-4a71599257f0

Submitted December 26, 2019 at 11:41AM by salahudinmalik

Node.js Extract Information from PDF File Using PDF Parse Library

https://youtu.be/THauKA1p7po

Submitted December 26, 2019 at 10:49AM by coderchrome123456

Wednesday 25 December 2019

MERN stack boilerplate

I have recently created a MERN stack boilerplate, which allows you to create user profile, and authenticate user with JSON web token. This boilerplate is inspired by this project by Brad Traversy.Please feel free to clone my repo, run it, and provide any feedback, thank you!Link to my Github repo here.

Submitted December 26, 2019 at 06:25AM by matlau_286

Build a GraphQL server in 6mins the easy way

https://youtu.be/iSaJOLcY7GI

Submitted December 26, 2019 at 07:07AM by ParablesBoltnoel

Node.js Web Scraping Cheerio HasClass Method Example

https://youtu.be/HIIDWYS2lZ4

Submitted December 26, 2019 at 06:04AM by coderchrome123456

Node.js Web Scraping Cheerio Library Tutorial for Beginners Working with Attributes Example

https://youtu.be/UxAK_e-PDpI

Submitted December 26, 2019 at 04:51AM by coderchrome123456

I'm getting "origin" undefined at CORS middleware

This is the middleware: private middlewares (): void { this.express.use(express.json()) const whiteList = ['http://127.0.0.1:8020', 'http://localhost:5000'] const corsOptions = { origin: (origin, callback) => { if (!!origin || whiteList.indexOf(origin) !== -1) { console.log(origin, 'rosrcharc') callback(null, true) } else { console.log(origin, 'moralmente') callback(new Error('Not allowed by CORS')) } } } this.express.use(cors(corsOptions)) } Always get's at the 'else' even tough 5000 is the correct server. I noticed that origin parameter is undefined. What can i do?

Submitted December 26, 2019 at 12:26AM by danilosilvadev

Websocket doubts

Hi! I'm getting deeper in websockets and in my research I found this:- websocket is a standard now with full browser support, so we can just use ws and let our clients connect with native API for websocket.Pros:* Plain native solution* Clients could use a lot of alternative libsCons:* We have to write our own boilerplate code in order to get a full solution with reconnect, disconnect detection, rooms, heartbeat, in server and each client. This is even suggested in ws documentation.- Socket.io is a battle tested socket solutionPros:* Oficial client for Java, Swift, etc.* A lot of plugins, docs and community.* Support all the weird scenarios: load balancers, proxies, etc.Cons:* Adds delay on initial connection because a custom protocol (polling and upgrade to websockets)* A little unmantained (a lot of unresolved issues and last publish 3 months ago)- Sockjs is a very very popular socket solution, I could not understand why.Pros:* Support all the weird scenarios: load balancers, proxies, etc.Cons:* Without oficial client for Java, Swift, etc.Questions+ Could you tell me if I'm wrong or I'm missing something?+ Why sockjs is getting more installs than socketio when sockjs doesn't have Java/Swift clients? How could you use sockjs if you can't use it in your mobile apps? Even in hybrids apps you have to write/use native code/modules in order to have a background service.* Why ws is getting more installs than every body when you have to write your own boilerplate for each one (server, web, android, ios)?Here the comparision

Submitted December 25, 2019 at 11:43PM by dengue8830

My small open source project

Hey my developer friends.I make my first open source project which is usable for developers , so im feeling excited :DI'll drop link for npm and you can also find github page in npm page already , please star project this will make me motivatedhttps://www.npmjs.com/package/js-json-db

Submitted December 25, 2019 at 08:30PM by ahmetbcakici

Node.js Web Scraping Cheerio Library Tutorial for Beginners Basic Example

https://youtu.be/75YwA6fWMWo

Submitted December 25, 2019 at 06:47PM by coderchrome123456

Migrate existing node apps to GraphQL without changing any code with Space Cloud

https://blog.spaceuptech.com/posts/migrating-existing-rest-apis-to-graphql/

Submitted December 25, 2019 at 05:46PM by YourTechBud

How to add Tables to PDF Documents Using PDFKit Library Plugin Voilab Pdf Table in Node.js

https://youtu.be/RSzMidcXeeA

Submitted December 25, 2019 at 04:00PM by coderchrome123456

Build a Image Converter App in Node.js and Express Using Multer and ImageMagick Library

https://youtu.be/ibgo-07ulgw

Submitted December 25, 2019 at 03:00PM by coderchrome123456

JavaScript achievements 2019

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

Submitted December 25, 2019 at 03:00PM by r-wabbit

Node.js ImageMagick Convert from PNG to JPG and Resize it Example

https://youtu.be/ioQr-F8NhCE

Submitted December 25, 2019 at 12:29PM by coderchrome123456

Node.js ImageMagick Image Processing Library Demo with Example

https://youtu.be/0KFaqL6cbMY

Submitted December 25, 2019 at 12:00PM by coderchrome123456

Can electron see/get open tabs on chrome browser?

Simple example. If I wanted to make an electron app that can copy all the URLs to your open tabs on a separate chrome browser, can this be done without having to create an extension for chrome? Can I tell it "see if chrome is open. If it is, make an array of the tab URLs etc"?

Submitted December 25, 2019 at 11:21AM by Echsplaine

Is /r/node becoming a toxic forum? Or am I not understanding it?

I've posted the same post on this subreddit (https://www.reddit.com/r/node/comments/ef0qkd/other_than_rest_and_graphql_what_do_you_guys_use/) and on hacker news (https://news.ycombinator.com/item?id=21871553).On Hacker News the replies are long, elaborate and insightful.On reddit I get a lot of negative answer that basically make me feel dumb. Most ironically, the most useful answer I got on reddit was the most downvoted one. I don't understand.What's going on? Is reddit toxic? Is this subbredit toxic? Am I not understanding some kind of preferences and tastes of /r/node folks?Merry Christmas though :-).Edit: Some answers on Reddit are nice and insightful though. But still a lot of negativity.

Submitted December 25, 2019 at 11:22AM by palberg7

How Does Memory Mapped I/O Work? Building a 16-bit VM in JavaScript

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

Submitted December 25, 2019 at 08:47AM by FrancisStokes

Build a Text to Speech App in Node.js and Express Using Google Text to Speech (GTTS) Library

https://youtu.be/Jpni3PopSY0

Submitted December 25, 2019 at 07:45AM by coderchrome123456

Tuesday 24 December 2019

Backup Docker Container instead of any Database by using Shell Script and save a lot of time

https://medium.com/@salahudinmalik/backup-docker-container-instead-of-any-database-by-using-shell-script-and-save-a-lot-of-time-fc39e8092d80

Submitted December 25, 2019 at 07:30AM by salahudinmalik

Understand Message Queuing system with RabbitMQ

[RabbitMQ is one of the most popular open-source message brokers. We take it for a spin with Node.js.](https://blog.logrocket.com/understanding-message-queuing-systems-using-rabbitmq/)

Submitted December 25, 2019 at 06:31AM by alexander-nnakwue

Suggestions for interesting projects with Node for holidays?

Please comment your response with reference material if any, it would be great if anyone could help out. Thanks. Happy holidays!

Submitted December 25, 2019 at 06:09AM by kshitijzutshi

We (group of self learners) got together to build a tool to help web devs deploy their apps to their own servers quickly under their own domain names. Hope someone finds it useful.

https://garagescript.github.io/myProxy

Submitted December 25, 2019 at 03:57AM by yjlim5

Is there any good example of an API application using worker threads correctly?

I know that worker threads are used for computation intensive tasks, but I am not sure whether it includes Mongoose calls or not. I would think sorting and mathematical calculations are computation intensive tasks, but I am not too sure about the others, so looking at an API using worker threads correctly would be immensely helpful.

Submitted December 25, 2019 at 02:34AM by jesusscript

Introduction to IoT with Raspberry Pi and Node.js using RGB LED lights

https://medium.com/@thatisuday/introduction-to-iot-with-raspberry-pi-and-node-js-using-rgb-led-lights-77f4750a5ea9?source=friends_link&sk=ff103ba9d99559f353ba83913a17333f

Submitted December 24, 2019 at 11:00PM by kiarash-irandoust

I get this error when I try to call firebase scripts in the html file; more info inside

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

Submitted December 24, 2019 at 09:01PM by srawratsoleg

How use pusher real time reddit API in node.js?

Hello, I was programming a bot to get new posts from reddit api, but I had the problem of * what were new posts *.so i met the pusher with reddit that inserting in html.Script tag with source = "htt.p://js.pusher.com/2.2/pusher.min.js"you get it in real time as instances of sub-credit posts. But I didn't find this module in node.jsI was wondering if anyone knows a way to use this on node.js if it's wrong.or another tool that does the same.I tried using the GGGscript module to inject the script into my bot but gave error in the script itself.will help a lot to get this tool :)

Submitted December 24, 2019 at 09:07PM by foln_ossias_

How to dynamically generate a directory tree as a string or object

https://www.petroskyriakou.com/how-to-generate-a-directory-tree

Submitted December 24, 2019 at 06:59PM by pitops

Build a Image Compressor App in Node.js and Express Using Multer and ImageMin Library

https://youtu.be/3-wMlbMYUeU

Submitted December 24, 2019 at 05:53PM by coderchrome123456

Download mp3 version of youtube video

Hey guys. I am working with Youtube Video To Mp3 and I tried node-ytdl-core and youtube-dl packages and they work the right way but it is too slow. as it seems for me ytmp3.cc works much more efficiently than this packages. so is there any way to perform this task efficiently like 3-5 sec? Thanks

Submitted December 24, 2019 at 06:00PM by some_developer213

What's New in Mongoose 5.8: `Schema#pick()` and Better Stack Traces

http://thecodebarbarian.com/whats-new-in-mongoose-58-schema-pick-and-better-stack-traces.html

Submitted December 24, 2019 at 03:50PM by code_barbarian

Node.js REST-API boilerplate "What about error handling?"

https://github.com/watscho/express-mongodb-rest-api-boilerplate

Submitted December 24, 2019 at 03:14PM by fr1zz3r

Learn Sequelize ORM on Node.js with MySQL From Scratch in One Video

https://youtu.be/pxo7L5nd1gA

Submitted December 24, 2019 at 02:04PM by islempenywis

Other than REST and GraphQL, what do you guys use?

I'm building a web app and REST and GraphQL seem to be overkill for what I want to achieve. All I want is to get data for my React front-end and do couple of HTTP POSTs.I'm thinking of simply creating express routes and using JSON but it seems cumbersome. Or is that a common practice?I'm wondering what the alternatives to REST and GraphQL are.Curious to know what y'all use for simple web apps.

Submitted December 24, 2019 at 12:25PM by palberg7

Correct way to unit test Express middleware feat. Dynamoose?

I'm working on an Express application which uses Dynamoose within its middleware to save items into DynamoDB. I have a module which exports a function to do the heavy lifting; it validates the input, transforms it a little into a different format and then saves the transformation into the database.Database interactions are done using three, non-exported, helper functions within the same module: saveModel, getModel and updateModel.Ideally, I don't want to spin up a testing database while the tests are running. I would like to stub out the three aforementioned functions to mock database interactions and control the information that is sent to and from the stubbed functions in my tests.I've tried using SinonJS to create the stubs, but I think there's a scoping issue as the functions aren't exported. I'm using Jest to do my assertions.Does anyone know some good practices or tools to use? Perhaps I need to change my middleware function into an ES6 class to expose the three functions, and reference them in the (previously exported) main function via this.FUNCTION?Completely lost in this. Any help would be amazing.

Submitted December 24, 2019 at 11:53AM by K9Morphed

Build a Website Screenshot Full Stack Node.js App Using Express and Webshot Library

https://youtu.be/zNHStq0sxt4

Submitted December 24, 2019 at 11:44AM by coderchrome123456

Multi-Threading and Multiple Process in Node.js - Blog Post

https://flatlogic.com/blog/multi-threading-and-multiple-process-in-node-js/

Submitted December 24, 2019 at 10:27AM by ZestycloseChocolate

Converting circular structure to JSON error when trying to to GET or POST

Node.js Webshot Library to Take Screenshot of Website in PNG,JPG and PDF Format

https://youtu.be/sgplSC6Tt1k

Submitted December 24, 2019 at 09:31AM by coderchrome123456

Monday 23 December 2019

Build a Web Scraper with Node.js and Cheerio | IMDB Movie Scraper

https://youtu.be/M2edy0vDovo

Submitted December 24, 2019 at 07:38AM by coderchrome123456

Why JavaScript Tooling Sucks

https://www.swyx.io/writing/js-tooling/

Submitted December 24, 2019 at 05:29AM by fagnerbrack

Identifying the host domain from req.hostname

I have two environments for my project - UAT and PROD. The rest apis are available in api.company.com and api2.company.com respectively.For a particular implementation need, I need to know these domain names to differentiate between the environments instead of using the node env variable. I tried using the req.hostname and req['host']. They all return 127.0.0.1Is there any way to get the original domain from the req object?Thanks in advance.

Submitted December 24, 2019 at 05:35AM by donttalkaboutpoland

api server testing

Hello everyone,I am developing test data and api test code generator.Most testing tools require the developer to prepare test data and test code.However, with this s/w you don't have to do that.It generate both test data and api test code automatically.In addition, it can generate a large amount of test data or support the number of simultaneous connection test.​https://ggoons.com​I hope you guys enjoy with this program.Thanks.

Submitted December 24, 2019 at 01:06AM by repaging

How to Create REST API Easily using Node.js, Express.js, Mongoose.js and...

https://www.youtube.com/watch?v=HdddILdiGSo&feature=share

Submitted December 24, 2019 at 01:23AM by didinj

Best resources to learn Node?

Youtube videos, online courses, blogs, anything - I'm all ears

Submitted December 23, 2019 at 10:49PM by brombergmedia

Nodemon & dotenv

Long story short: If you wanna require dotenv, you can just do nodemon -r dotenv/config -- How do I put this into my nodemon.json config fie? I can not find any documentation on it

Submitted December 23, 2019 at 06:06PM by roconf

How to Create PDF Document in Node.js Application

https://youtu.be/_LFz4hx5b00

Submitted December 23, 2019 at 03:13PM by coderchrome123456

How make Logger based on different app folder?

I am building logger using winston lib. I have created 3 levels of log like info, debug and error. I have different microservice node app and one common module which controls all services. Here I have wrote log logic but now let's say I have 2 node app 1 is admin and one is services. So in log.js file of common module will create main folder for all log and in that one folder for admin and one for services inside parent log folder. How can I achieve this? #logger #nodejs

Submitted December 23, 2019 at 03:31PM by theromie

SQL vs NoSQL: Using React and Node

Hey everyone!I’m a bit of a back end noob and was hoping someone could shed some light on this.I am working on making a restaurant review site similar to Yelp. I’ve built the front end in React and will be using Node for the back end however I was wondering which type of database would be better to use on the back end: a SQL solution like PostgreSQL or MySQL or a NoSQL solution like MongoDB or Amazon’s DynamoDb.The database would need to store things like user accounts, a database of restaurants and information about them, as well as reviews for each restaurant and the user they were written by.Any help or resources are much appreciated!

Submitted December 23, 2019 at 03:06PM by brombergmedia

🌟Chrome V8 version 8.0 — V8, — What to expect? 🌟

https://medium.com/@ideepak.jsd/chrome-v8-version-8-0-v8-what-to-expect-11094d45411e

Submitted December 23, 2019 at 02:24PM by denomer12

Write Your Own Promisify Function from Scratch

https://101node.io/blog/write-your-own-promisify-function-from-scratch/

Submitted December 23, 2019 at 12:55PM by banna2

React Material UI Admin Template integrated with Node.js and Postgres database

https://flatlogic.com/templates/react-material-ui-admin-node-js

Submitted December 23, 2019 at 12:59PM by dante_white

As a beginner, is it important to learn vanilla (non-express) Node?

I am a beginner who completed Colt Steele's Udemy course (The Web Developer Bootcamp), and I'm about to start making projects for my portfolio. Should I concentrate on learning vanilla node, or can I get by just fine using just express for the foreseeable future?Thanks.

Submitted December 23, 2019 at 01:09PM by NecroDeity

Accessing a Windows share drive (from Linux) in node.js?

Hi folks,I'm trying to access a Windows share drive from a Cloud Foundry deployed node app on a Linux stack (cflinux2). From what I have pieced together to do this requires the samba protocol.I've messed around with samba-client but can't get it to work because the Linux stack doesn't have smbclient installed. Not sure if I can somehow configure that through Cloud Foundry somehow?Ok cool whatever, I'll try smb2! Echhh, top of the description says it shouldn't be considered production ready and I'm not able to quickly access at work because its dependency is missing a license, makes our legal team sad :-)So what can I do: * Deploy using a Windows server - nope, sadly my company is unable to do this, it would be a fix though * Develop my own samba protocol implementation on node - holy smokes please no, I just want some files on a drive my man * Use some other approach I don't yet know about..?So any thoughts on how I can do this? It's driving me a little crazy, especially because I was trying to make a very lightweight node app to replace an ugly as hell spring boot behemoth but now I'm finding there isn't great package support for this process.Apologies if I have a butchered understanding of things, I hadn't the faintest clue about Windows share drives and samba a day ago!

Submitted December 23, 2019 at 11:57AM by codescapes

Hapi.js Tutorial | How to Serve Static Image Files in Directory in Hapi.js App Node.js

https://youtu.be/xK6vlFRtu3s

Submitted December 23, 2019 at 11:06AM by coderchrome123456

Deep Dive Into Worker Threads in Node.js

Node.js Worker Threads is a great way to implement CPU intensive applications using Node.js. This article describes the untold in-depth story of how Worker Threads in Node.js work.https://blog.insiderattack.net/deep-dive-into-worker-threads-in-node-js-e75e10546b11

Submitted December 23, 2019 at 11:11AM by dpjayasekara

A Complete Guide to AWS Elastic Load Balancer using Nodejs - Cloudnweb

https://cloudnweb.dev/2019/12/a-complete-guide-to-aws-elastic-load-balancer-using-nodejs/

Submitted December 23, 2019 at 08:51AM by GaneshMani

Hey guys I am having trouble with SSL certificate.

My hosting provider is Heroku and I bought domain on GoDaddy. I don't know how to add SSL certificate to my website. I tried Certbot but it didn't work. Please help me.

Submitted December 23, 2019 at 07:50AM by Varenberg

Writing cross-platform Node.js

https://shapeshed.com/writing-cross-platform-node/

Submitted December 23, 2019 at 07:52AM by pmz

Sunday 22 December 2019

Node.Js Online Training

https://nareshit.com/nodejs-online-training/

Submitted December 23, 2019 at 06:42AM by nareshithyderabad

Task Based Screenshot Exports

Hi Guys,​I've built a task based [screenshot exporter](https://github.com/gs-asrivastav/screenshots-exporter.git) using Puppeteer & Generic Pool. Following are the tasks I've exposed as of now, thinking of extending it to. Table -> Excel/CSV Exports, Export File to Slack etc.TaskTask KeyMount external script fileADD_SCRIPT_FILESet cookiesSET_COOKIESWait for custom/DOM eventsEVENT_WAITCall JS FunctionsFUNCTION_CALLInteract with DOMDOM_INTERACTIONTake screenshot of elementELEMENT_SCREENSHOTTake screenshot of entire viewportVIEWPORT_SCREENSHOTExport viewport as PDFVIEWPORT_PDFNavigate to another URLNAVIGATIONStatic sleep for n millisecondsSLEEPLet me know what you guys think of it.

Submitted December 23, 2019 at 03:55AM by avnsri4986

Why npm lockfiles can be a security blindspot for injecting malicious modules

https://snyk.io/blog/why-npm-lockfiles-can-be-a-security-blindspot-for-injecting-malicious-modules/

Submitted December 23, 2019 at 12:50AM by ViolentHomme

How to write unit tests for functions that return void (CQS Commands)?

/r/AskProgramming/comments/eec8s3/how_to_write_unit_tests_for_functions_that_return/

Submitted December 22, 2019 at 11:43PM by JamieCorkhill

passport-google-oauth20 not working in production?

It works fine in dev, but when I try to use it in production, once I select my google account it just keeps loading without redirecting until the connection times out. this is my googleStrategy code:EDIT: forgot to add. I also tried using an absolute path in the callback URL, but it's not working. passport.use( new GoogleStrategy( { clientID: keys.googleClientID, clientSecret: keys.googleClientSecret, callbackURL: "/auth/google/callback", proxy: true }, (accessToken, refreshToken, profile, done) => { User.findOne({ googleId: profile.id }).then(existingUser => { if (existingUser) { done(null, existingUser); } else { new User({ googleId: profile.id }) .save() .then(user => done(null, user)); } }); } ) );

Submitted December 22, 2019 at 09:51PM by Ivaanrl

API / JWT Question

When authenticating an API using JWTs that contain the user's ID, is it better to verify the token, extract the id and compare it to the route parameter or use the id directly for creating a resource.Example 1:POST example.com/api/users/:userId/itemsComparing that the route param userId matches token.id before creating the resource- OR -Example 2:POST example.com/api/itemsUsing token.id directly for identifying the owner and then creating the resource​I'm thinking option 1 is the way to go, but I wanted to know what others would do and why.Sorry if this was poorly worded.Thanks in advance!

Submitted December 22, 2019 at 09:17PM by dumbdevquestions

Getting Chrome like debugging on standard console.

Hello. Do you know how the chrome console and the node dev tools console have the enhanced functionality of printing out variables without console log and for allowing me to paste large blocks of code into the prompt (without having to program in a readline event)?What is this called? I might be having trouble explaining it.I would like to not have to use devtools to get this functionality. It appears present when I start up just node.exe and the resulting 'console' window works like chrome, but if I start the program like 'node byteframe.js' this functionality is lost?Ugg I can't express myself properly. Do I have to do something like this? https://exceptionshub.com/calling-a-web-service-using-nodejs.html

Submitted December 22, 2019 at 07:18PM by byteframe

I'm getting an error refused to load the font ''

Node.js Image Directory Listing in Form of Gallery

https://youtu.be/H9o3ej8DB-k

Submitted December 22, 2019 at 05:18PM by coderchrome123456

Node.js Web Scraping | How to Scrape Remote Image and Download it Using Cheerio

https://youtu.be/EeQnDjYE9P8

Submitted December 22, 2019 at 02:28PM by coderchrome123456

Node.js Percollate Command Line Tool to Grab Web Pages as Beautifully Formatted PDFs

https://youtu.be/45QDjZYYhwE

Submitted December 22, 2019 at 12:04PM by coderchrome123456

Create multiple Angular applications inside single repository using Nrwl NX

https://www.tutorialslogic.com/blogs/nrwl-nx

Submitted December 22, 2019 at 10:24AM by ukmsoft

Saturday 21 December 2019

My Node.js-powered Christmas project (with incredibly messy code)

https://v.redd.it/e1lyjyjh24641

Submitted December 22, 2019 at 04:19AM by zooza310

All Node.js Frameworks Suck Compared to Rails

When it comes to Developer Experience and speed of iteration, all node.js suck in comparison to Ruby on Rails.I wish the node.js community would stop creating new and shiny frameworks every month and devote the focus, time, and energy on a single framework. Every framework from express, koa, next, sails, Adonis, meteor, nest, hapi, loopback, etc, blah, etc, blah has a certain flaw or weakness and all are not as great as rails as a comprehensive framework that just lets you get things done.It’s time for the community to stop creating new node.js frameworks and double down on a set of frameworks like the php, ruby, and python community has.

Submitted December 21, 2019 at 11:34PM by incognitocode

Log-My-Node : See line number and file when logging in node.js and express.js

https://github.com/yasimba/log-my-node

Submitted December 21, 2019 at 07:29PM by th3ch073n1

Is nodejs a reasonable choice for my use case?

Hey Guys,I have seen people advocating for nodejs provided that no request take a long time to complete, apparently because of the single-threaded nature of the nodejs.Say of my requests require to iterate over all records in a relatively large table and applying a join for each of them. I assume this is not a light-weight operation so it will take time. Does it mean that nodejs is not a good web server for me then? What are my options. (note that I don't need to result of this operation in real-time).Thx

Submitted December 21, 2019 at 06:49PM by hassanzadeh

Angular Material Side Navbar

https://w3hubs.com/angular-material-side-navbar/

Submitted December 21, 2019 at 06:21PM by w3hubs

Trying to understand AdminFS

I already have this setup in other areas and through poking and prodding I've gotten it to work in those areas, but I still don't understand what is going wrong. I am hoping someone can explain it to me. Here is the Firebase Admin Firestore code: -async function that is also middleware- let user; await adminFS.collection('users').doc(req.body.uid).get().then(doc => { if (!doc.exists) console.log('User not found.'); else { try{ user = { uid: doc.uid, email: doc.email, displayName: doc.displayName, subscriptionLevel: doc.subscriptionLevel, subscriptionID: doc.subscriptionID, admin: doc.admin, token: doc.token } console.log(doc); console.log(user); } catch (err){ console.log(err, err.stack) } } console.log(user); }); console.log(user) So, console.log(doc) will give me all the information I need but also information I don't need but if I use something like token.uid it will be undefined. The first console.log(user) will result in nothing even though (in my mind) user should have been just defined. Even after the if statement has completed, the user is still undefined. Even after using Async and Await, which should force it to be sequential, user is still undefined.

Submitted December 21, 2019 at 06:25PM by sinithw

How to incrementally implement Typescript in your NodeJS project

https://www.ranjithnair.dev/typescript-progressive/

Submitted December 21, 2019 at 05:31PM by FrankUnderwoods

Unable to redirect after using XMLHttpRequest.send()

Hello, I've recently been hitting my head on a wall over what feels like a simple problem.In the past, I was using simple post forms, but since then, a few things changed, and instead of using a form, I ended up using multiple input fields, with a submission button that uses XMLHttpRequest.send()When it was a simple form, the backend itself was able to redirect with a simple res.redirect, but since changing over to this new posting method, I've not been able to do so.Not only that, but if I bypass this problem by redirecting in the client-side js, it stops the back-end from finishing its task (Login/Registration.)The chunk of code I've been using to send the details is this:xhr.open("POST", '/user/login', true); xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xhr.send(JSON.stringify(userDetails));

Submitted December 21, 2019 at 04:39PM by monkey_programmer

Creating a Zero-downtime cluster in NodeJS

https://medium.com/@alonso.oliverio/creating-a-zero-downtime-cluster-in-nodejs-ad879ee3160?source=friends_link&sk=dd21f2377a9c312ff31a3b434b077503

Submitted December 21, 2019 at 02:52PM by kiarash-irandoust

Parse an array (type string) to object

This seems to be a very silly question, but I have spent quite a lot of time on thisvar listOfNames = "['google', 'facebook', 'twitter']" // this is of type string How do I parse this as an Object ??Like thislistOfNames[0] to get the value 'google'JSON.parse would throw an error : Unexpected token ' in JSON at position 1

Submitted December 21, 2019 at 02:05PM by mahesh_kumaran

[Update] A client project is getting a massive momentum, I need to prepare the nodejs infrastructure for this weekend

Okay guys,Time for an update on this postNow the infrastructure is as fast as it could be (100 ms average/req), while we are receiving on average 300k unique/day peaking around the end of the afternoon, and with peak days with half a million unique visitorsThings that helped a lotI learned how to use, configure and optimise postgres connection pool, this was BY FAR the best optimisation (Check this: https://node-postgres.com/features/pooling)I ran a ton of stress tests to find the app bottlenecks, loader.io and artillery are very nice tools for thisFor the heavier SQL requests, I transformed them into static values and cached them, values are updated every 5 minutes by a cron job. It doesn't change anything for the end user as for the data displayed, but change everything for our response time and infrastructure loadThere are a few other minors changes, but those are the 3 main things that helped a lot

Submitted December 21, 2019 at 02:06PM by OogieFrenchieBoogie

Twitch Streaming: Just started a Nodejs project Utilizing Socketio and my own weird way of doing things

https://www.twitch.tv/jamie_337_nichols

Submitted December 21, 2019 at 01:07PM by jamie337nichols

Node.js REST API Using Express 4 Routers and Mongoose (MongoDB)

https://youtu.be/SRG7av7sZKs

Submitted December 21, 2019 at 12:42PM by coderchrome123456

Sorting done right... or not

Hey everyone and thanks for reading this.So, here is the case. I need to reorder ~10 elements (drag'n'drop is done by the front-end). I can send a request to sync the list order on each move, or add a "Save" button and click it when all editing is complete?Which method is actually the best practice? Let me know what you think :)

Submitted December 21, 2019 at 12:07PM by exsesx

date changes with time

This is the code that I used:

Published by: <%= rxpost.author.username %> , <%= moment(rxpost.createdAt).format('MMMM D, YYYY') %>

But as the day passes, the date changes. Example, I submitted a post on the 19th, and now it says the 20th. Any ideas how to fix that?

Submitted December 21, 2019 at 11:11AM by nightcrawler99

How to Download Files From URL in Node.js Using Node-Downloader-Helper Library

https://youtu.be/TecUuWtmaEc

Submitted December 21, 2019 at 09:13AM by coderchrome123456

Friday 20 December 2019

Building a simple REST API with NodeJS & Fastify Tutorial

https://youtu.be/Yr5ZXtZg6S8

Submitted December 21, 2019 at 06:43AM by coderchrome123456

Advanced online course on Node and backend in general?

Hi! As the title says, I'm looking for an advanced online course on backend development. 99% of the courses I find online only include the basics, and after 3 years of doing APIs (not full time) I think I know how to use express and postman... What I'm looking is to go a couple of steps further, learn different design tactics, learn when to use each type of db... To make it short, be a senior developer.I have a full time work, so it has to be something I can manage when to study, and even though I love reading, I just can't learn from reading a book on this kind of things, and get bored after a couple of pages, so that's why I'm looking for an online course, even though it's paidDo you have one to recommend me?Ps, sorry if this has been asked before, the reddit search engine is not the best...

Submitted December 21, 2019 at 03:34AM by shinobiwarrior

What method do you use at your company for API development?

I'm currently looking for a decent Swagger package for Node but so far I had no luck. What method do you use at your company?

Submitted December 20, 2019 at 10:03PM by JaniRockz

Authentication server with express and postgres

Recently I had to build an auth server for a project and LITERALLY could not find anything about how to do it with node and postgres.Here it is if anyone is having the same issue.https://github.com/iqbal125/express-postgres-auth

Submitted December 20, 2019 at 08:42PM by iqball125

Love Javascript, but don't care for Html or Css.

I guess my question is, should I or could I land my first role as a node dev? Or are the odds against me and I need to start in front end? To be clear I know Html and Css basics, it's just not something I prefer is all. Also any resources would be helpful.

Submitted December 20, 2019 at 08:09PM by SigP320sc

Any database-agnostic, high-level abstraction layers that can handle MongoDB, Redis, Elasticsearch, and Postgres?

I'm creating a web API. I'd like to be able to do most of the prototyping in Mongo, and switch to Postgres for prod. With Redis for caching and Elasticsearch as the search engine.Atm, I'm just using the MongoDB driver directly for prototyping; the data that I'm handling doesn't have any sort of fixed schema. I'd like to switch this out for some sort of abstraction layer. Ideally, I could write all of my db queries for Mongo, and simply switch out the Mongo adapter for Postgres, Redis, and ES adapters as needed.I've used Sails before, so my first thought was to use Waterline as a standalone module (which I've never done before). Any other recommendations?

Submitted December 20, 2019 at 06:52PM by the_nicomachean_man

Moving from Babel ES modules to pure Node.js 13.2

As of Node.js 13.2, ES modules are supported without a flag. I have a large project that supports ES module syntax with babel, and now I'd like to remove babel if possible. However, this doesn't seem to be as simple as adding "type": "module" to my package.json and ripping out babel.For one, none of my import statements include .js on the end. Most look like import Thing from './thing' to import the default export from the thing.js file. The Node implementation of ES modules seems to require the .js on the end (I get a Cannot find module... error without it). I'd love to not have to go around renaming every one of my imports to end with .js.I also have tons of modules organized as folders with an index.js in them which controls the public interface of the module. Every usage of this imports only the folder name (import Thing2, { otherThing } from './thing2 imports the default export from ./thing2/index.js). This also seems to give me a Cannot find module... error, and again, I'd like to not go change everything to import from ./thing2/index.js.Is what I'm doing not actually ES module spec compliant and just some extra Babel sugar? Is support for this in Node still forthcoming? Having trouble finding documentation to explain how/if Node is supposed to ever handle these two examples.

Submitted December 20, 2019 at 05:51PM by rca06d

How to Upload Files to Node.js Express Server Using Express FileUpload Library

https://youtu.be/ymO_r1hcIXk

Submitted December 20, 2019 at 02:27PM by coderchrome123456

Node.js ImageMin Library for Compressing PNG and JPG Images

https://youtu.be/AUMc7MEn49E

Submitted December 20, 2019 at 01:28PM by coderchrome123456

Best Tutorial To Become Master In JavaScript Closure - CodesQuery

https://codesquery.com/javascript-closure/

Submitted December 20, 2019 at 12:53PM by hisachincq

Build a Full Custom PDF Viewer App in Javascript Using PDF.js Library

https://youtu.be/85-_8j-u4WI

Submitted December 20, 2019 at 12:30PM by coderchrome123456

Manipulating date and time for api request?

Hi, I have an Express server that has to do an external API request using the format:/api/{locationId}//power/usage?period=?&startTime=2019-11-12 05:00:00.0&endTime=2019-11-12 7:00:00.0I need to be able to get the current date and time and put it as the the last 15 minute interval for the endTime and automatically have the startTime as 24 hours previous to the EndTime.Does anybody have an idea of how to do this? Your help is very appreciated.

Submitted December 20, 2019 at 11:54AM by mrcandyman

20 ways to become a better Node.js developer in 2020

https://medium.com/@me_37286/20-ways-to-become-a-better-node-js-developer-in-2020-d6bd73fcf424

Submitted December 20, 2019 at 10:57AM by dobkin-1970

Create salted hash with output length under 40 characters

Is there a way to make Bcrypt (or a similarly secure hashing library) output hashes with a length under 40 characters?My intention is to use Bcrypt to hash a user ID so that it can be used as a password for a third party service that only accepts email+password logins. However, the service only accepts passwords with length of 40 characters or less.How could I accommodate this restriction while still keeping passwords secure.​FYI, the user ID and output password will be visible to the user.

Submitted December 20, 2019 at 09:04AM by factory_decorator

How to start a Node.js project

https://philna.sh/blog/2019/01/10/how-to-start-a-node-js-project/

Submitted December 20, 2019 at 08:38AM by pmz

Thursday 19 December 2019

I made a Windows app using Node/ExpressJS & ElectronJS to send YouTube audio to your Sonos Devices. It’s currently testing/beta and need some feedback!

https://github.com/GPudgima/YT-SONOS/releases

Submitted December 20, 2019 at 07:05AM by Pudgima

How to run and deploy a cli with package json.

This is my first node cli and first npm publish. Not sure what went wrong.I am using windows git bash.When I run it as node index.js. it works as expected with colors. here is the result .package.json"author": "rakesh shrestha","license": "ISC","dependencies": { "chalk": "^3.0.0", "ejs": "^3.0.1", "figlet": "^1.2.4", "inquirer": "^7.0.1", "inquirer-fuzzy-path": "^2.2.0" },"bin": {"intelligent-wizard": "./index.js"}But when I run the cli with package bin intelligent-wizard it doesn't work the same, colors aren't displayed.using the bin command intelligent-wizard it shows likeAnd Whenever I download this package on a new computer I need to do npm-linkhow can i avoid it?here is my package, its small. https://www.npmjs.com/package/intelligent-wizard.

Submitted December 20, 2019 at 04:12AM by rakeshShrestha

Devs - For those who are struggling with weight loss/fitness and health goals

I know that as Devs, some of us are struggling with losing weight, putting on muscle, getting in shape and building healthy eating habits. We often have chaotic schedules, are often stressed and running low on willpower.I'm building a small business as a consultant helping people with exactly that so I'm wondering, for all those that are struggling with getting in good shape, what are the biggest stepping stones you have encountered ? What keeps you from reaching your fitness goals & What bothers you the most about ?

Submitted December 20, 2019 at 01:57AM by dev_muscles

dates on posts and comments?

this is how a post is presented, but it's always "few seconds ago"

Submitted by: <%= rxpost.author.username %> , <%= moment(rxpost.createdAt).fromNow() %>

I would like it to mention the date instead...https://ibb.co/wwW3ZWR

Submitted December 19, 2019 at 11:09PM by nightcrawler99

I purchased a domain name from name.com and hosting my node based server at aws lightsail, where could I configure a forwarding email address?

Say I want an email like info@domain.com, do I need to configure it on name.com or aws, since nameservers are being provided by amazon. I just want my email to forward the mails, dont need mail sever or backup. TIA

Submitted December 19, 2019 at 09:02PM by dsmedium

Project structure for a big Apoll GraphQL app

I see a lack of articles which talk about a code structure for a really big Apollo GraphQL projects. I mean hundreds of queries and mutations. I've seen some examples but all of them gets really messy at some point. Do you know about some articles/examples for really big applications?

Submitted December 19, 2019 at 02:48PM by HonzsSedlomn

Is Node.js a good back end option for implementing a distributed streaming system?

I was thinking Node.js was a poor choice for it, because of the fact you're not supposed to run computationally intensive tasks on Node.js to fully take advantage of its biggest strengths, but I wasn't sure.

Submitted December 19, 2019 at 02:49PM by jesusscript

How to Architect a NodeJs Project from Ground Up

https://blog.soshace.com/how-to-architect-a-node-js-project-from-ground-up/

Submitted December 19, 2019 at 02:53PM by UncleBen2015

Node.js Loader Hooks for Fun and Profit - Vladimir de Turckheim, Sqreen

https://youtu.be/irPCeoO-jjI

Submitted December 19, 2019 at 04:39PM by ecares

How to dockerize your Node.js Express application for AWS Fargate?

https://cloudonaut.io/how-to-dockerize-your-nodejs-express-application-for-aws-fargate/

Submitted December 19, 2019 at 03:56PM by widdix

Writing Tests in your Node JS API Application

https://medium.com/@hellotunmbi/writing-tests-in-your-node-js-api-application-cfb5592df466?source=friends_link&sk=67e4c40ec098e63feab6d56427241155

Submitted December 19, 2019 at 04:22PM by wineandcode

NodeJS hotreload with Gulp for beginners!

** Hello NodeJS devs! **I have been using a Gulp script to live debug my Node scripts on VScode and I want to share the code with you.If you are tired of re-running and re-debuggin everytime you chnage the code, this repo is perfect for you :)This also works on any IDE/Editor that supports Node attach debugging.Link: https://github.com/RsPlayer/Nodejs-Hotreload (Read README to use it)You can learn more about Gulp and how to use it here: Gulp DOC

Submitted December 19, 2019 at 02:01PM by rouisibra7

good resources for complex api design?

Hello fellow programmers. I'm on my second year learning web development and I enjoy handling APIs. At first I started doing them because nobody liked to do that and also I was frustrated with poor management from other devs in API architecture.Since then, I have built a few APIs with expres that handled token authentication AND authorization and a few dozens routes with role management but I know I barely scratched the surfaceI want to take it further and I found the microsoft doc which sounds amazing but it's for C#Any of you would have a good recommendation for a JS complex API architecture doc?Thanks in advance for your answers

Submitted December 19, 2019 at 01:00PM by Fearmin

A simple and smart way to define errors with localization enabled.

https://github.com/calidion/errorable

Submitted December 19, 2019 at 12:12PM by calidion

How to Install Nodejs in AWS EC2 in a proper way - Cloudnweb

https://cloudnweb.dev/2019/12/how-to-install-nodejs-in-aws-ec2-in-a-proper-way/

Submitted December 19, 2019 at 11:28AM by GaneshMani

Calculator In Javascript With Bootstrap 4

https://w3hubs.com/calculator-in-javascript-with-bootstrap/

Submitted December 19, 2019 at 10:43AM by w3hubs

GitHub - watscho/express-graphql-mongodb-boilerplate: A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql

https://github.com/watscho/express-graphql-mongodb-boilerplate

Submitted December 19, 2019 at 10:17AM by pmz

ClipboardJS Example | Copy to Clipboard in Node and Browser

https://youtu.be/ij_bCgsNWOY

Submitted December 19, 2019 at 09:09AM by coderchrome123456

Your first Strapi plugin

https://www.reddit.com/r/Strapi/comments/ecqtxo/your_first_strapi_plugin/?utm_source=share&utm_medium=web2x

Submitted December 19, 2019 at 09:21AM by jesusprubio

Node, JavaScript, Css, Html, Angular

https://www.tutorialslogic.com/javascript?vl

Submitted December 19, 2019 at 08:23AM by ukmsoft

PDFObject Library - Render PDF Documents in Node and Browser

https://youtu.be/HMCSfblu7xM

Submitted December 19, 2019 at 07:04AM by coderchrome123456

Wednesday 18 December 2019

How do I send a file from a NodeJS Windows Task to a Localhost NodeJS API for AWS upload?

I run a task every 2 hours, the task results in 2 files being generated. I need to pass those files from the NodeJS task to the NodeJS API so that they can be uploaded to an S3 bucket. Any thoughts would be appreciated.

Submitted December 19, 2019 at 06:29AM by sinithw

Face recognition added to Postput features!

https://github.com/postput/postput

Submitted December 18, 2019 at 11:12PM by Arnadus

Best framework/library to make a game server for a js game?

The options I've come across are:https://socket.io/https://webrtc.org/https://www.actionherojs.com/Which am I better off using for a webapp game for responsive real time multiplayer?

Submitted December 19, 2019 at 03:14AM by lemon07r

Node v13.5.0 (Current)

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

Submitted December 18, 2019 at 07:13PM by dwaxe

Symfony Workflow alternative in NodeJS?

I am looking for js state machine library that can save state to database.So far I found lots of state machines in js (machina-js, javascript-state-machine, stately, xstate), but those are pure libraries without any object abstractions around it.In Symfony Workflow you can configure Entity and its property. Is there any node framework or library that provides some conventions and skeleton for workflows and state machines?

Submitted December 18, 2019 at 05:57PM by vueco

VideoMail.io Node Library | Record Videos From Camera and Send it Through Email in Javascript

https://youtu.be/trTYDD2ukBs

Submitted December 18, 2019 at 05:03PM by coderchrome123456

Beta testing of ~15k lines of codebase written mostly in node.js

HI!https://dmt-system.com https://github.com/uniqpath/info https://dmt-system.com/slides/dmt-player.pdfLooking for beta testers (all information that I can provide at the moment is in these three links) and then over email individually (write to info@uniqpath.com if you want to test). Testing is 100% safe because you can test on an offline RaspberryPi if you wish -- or, even better, you can check the source code for any missteps (there are none) when you receive it. You basically would have to only check for any filesystem wrongdoing or outside sending of information. It's easy to check for both. Code is going to land on GitHub on the release date (without the IoT part for now).This project is coming "out of the blue" and it's a bit tricky for people to take a leap of faith. Nevertheless we got quite some testers already but we are looking for more because there are different aspects of the system to test.Just as a fun trivia: I smoked a joint with Ryan D. a year before he invented node.js :) I'm not sure if it helped him but it sure helped me. I saw how to think outside of the box by listening to him and later observing what happened.Thank you! david

Submitted December 18, 2019 at 05:21PM by davidhq

GraphQL Server Design @ Boxed

https://tech.boxed.com/graphql-server-design-boxed-ea02ac95d01b

Submitted December 18, 2019 at 04:48PM by dearkitect

Sharing DB connection in GraphQL

I’m re-writing a terrible hand rolled di injection container at work to share our aws-sdk client, amongst other things. We’re using GraphQL so I first thought, why not put it in Context? The further I got, I found services being instanced above resolver scope with access to Context, so then I moved it up to instanciating in a function that creates the schema. But then, I had another idea.. why am I doing this at all? Can’t I just do:// dB.js export default createConnection(); // service.js import dB from dB Create an effectively singleton instance, then import where needed? It looks perfectly testable and massively more convenient than passing through function calls. Is this actually a bad idea for any reason?

Submitted December 18, 2019 at 04:38PM by stashrx

Thoughts on Bazel or CMake.js as an alternative to node-gyp? Any others?

BazelCMake.jsnode-gyp

Submitted December 18, 2019 at 04:26PM by brianjenkins94

How to Develop Node.js Applications in Kubernetes

Benefit from the entire node.js toolkit (including debuggers) while developing your application directly in Kubernetes:https://okteto.com/blog/how-to-develop-node-apps-in-kubernetes/

Submitted December 18, 2019 at 02:05PM by pchico83

Distributed Tracing in your Kibana with Node.JS

https://medium.com/@evgeni.kisel/distributed-tracing-in-your-kibana-with-nodejs-610c9f07b4b4?source=friends_link&sk=016dc9f393af182edb8cfedb588e7ee3

Submitted December 18, 2019 at 02:07PM by kiarash-irandoust

How do I set up google polymer 3 in express.js?

How do I set up google polymer 3 in express.js? I've never used polymer before, and I can't seem to get a hello world app to work. I've spent 2 days googling this, and it sounds like polymer 3 is setup much different from the past versions. I'm only finding tutorials and documentation and tutorials for the past 2 versions. I've seen versions that work for angular, but would like to avoid using angular, and would rather use express to build my webpages. I can use typescript if needed. It seems the issue is, polymer doesn't put a / in front of it's directory's in the module, and the module scripts are not public. I've heard of bower install, but there npm suggests I use something else for polymer. Can someone educate me on what I should to do?

Submitted December 18, 2019 at 02:23PM by SwiftNinjaPro

GraphQL vs REST - a vending machine example

https://blog.graphqleditor.com/graphql-vs-rest-vending-machine-example/

Submitted December 18, 2019 at 12:33PM by oczekkk

Schedule jobs with Agenda JS

“How I schedule jobs for my pet project” by Hung Tran Nguyen https://link.medium.com/PaSCDWAgw2

Submitted December 18, 2019 at 12:53PM by nguyenhungtran1986

Does my app get bigger when I split my code to many files and I import modules in every file I use?

Hello!I have started learning NodeJS and I'm doing my experiments and developing a habit of splitting my code to many many files so that I when I have to change something I will do it only on a particular file and avoid too many lines of code, let me give you an example: routers.My web app has routers and one of them is called /about_us which is a parent and has the following children:/about_us/team/about_us/members/:id/about_us/mission/about_us/locationAnd each of them I have them split in multiple files.about_us_mainRouter.jsabout_us (folder)team.jsmembers.jsmissionlocationand there are times when I want to make some specific changes, for example, members I change only the members file.My router code is like this:about_us_mainRouter.js const express = require('express'), aboutUs = express(), members = require('./about_us/members'), mission = require('./about_us/mission'), location = require('./about_us/location'); aboutUs .use('/members', members) .use('/mission', mission) .use('/location', location); module.exports = aboutUs; and a file which gets imported is like this:members.jsconst express = require('express'), members = express.Router(), membersController = require('/controllers/about_me/members'); members.route('/:memberId') .get(membersController.retrieve) module.exports = members; As you can see in every router, I import express and express Routers and I've been wondering:Does my app, loads express() or express.Router() for every import I do? If I have for example imported express 100 times (if I have 100 Routers) does JavaScript/NodeJS load the module 100 times?Is there any way of skipping the imports, since I have imported them in other files, and making my code shorter even more?Thanks

Submitted December 18, 2019 at 11:45AM by MariosFFX

NodeJS December 2019 Security Releases

https://nodejs.org/en/blog/vulnerability/december-2019-security-releases/

Submitted December 18, 2019 at 10:39AM by CodePerfect

Structure & importing of database clients

Hey,I have a nodejs backend server, in which I am using various clients (firebase, bigquery, pubsub) - Right now I have a folder called `loaders` in which I initialise these clients and then import them into modules where they are needed.Is there a better way to do this? What are best practices for such a scenario?I have read about Dependency Injection but it mainly focuses on classes - I am steering clear of OO

Submitted December 18, 2019 at 09:11AM by ydennisy

[ASK] What is Middleware Kernel on JS Web Framework?

AFAIK I got "Kernel" definition from here:- https://simple.wikipedia.org/wiki/Kernel_(computer_science))- https://en.wikipedia.org/wiki/Kernel_(operating_system))As I read from the above pages, "kernel" does somewhat have a correlation with OS (Operating System).So my question is, what is "Middleware Kernel" on web frameworks like KOA or express?I get "Middleware Kernel" from here: https://github.com/koajs/koa/blob/master/docs/koa-vs-express.mdI would appreciate the explanation, thank you.

Submitted December 18, 2019 at 08:52AM by tonywei92

Looking for feedback on API & Docs

Hello everyone,I'm looking for skilled developers with API experience to test out our upcoming API & API Docs usability during a short online interview. (Hangouts / zoom)If interested, please fill in this intro survey and I’ll be in touch.https://forms.gle/rSDf8pt9GHK3fUfX6There will be a reward for your time. If you know about someone else who might be interested, feel free to share this link with them.Thank you and have a good day!

Submitted December 18, 2019 at 07:54AM by Steph_Ethfinex

Tuesday 17 December 2019

Top Node js NPM Packages for Image Processing

https://youtu.be/RIhBhPUe7t8

Submitted December 18, 2019 at 06:50AM by coderchrome123456

6 common Sequelize queries rewritten in SQL

https://maximorlov.com/6-common-sequelize-queries-rewritten-in-sql/

Submitted December 18, 2019 at 05:55AM by _maximization

how to protect public api?

I am currently developing public api.it will be public api and available at https://api.example.commy frontend app will talk to api and do whatever thing they need to do.but i don't want anyone to use my api, i want to have some kind of api key (which i saw from github or weather.com)to only allow registered app to use my api.is there a simple way to implement it?

Submitted December 18, 2019 at 04:17AM by jkh911208

Tundra: My small and customizable template engine

https://github.com/Usbac/tundra

Submitted December 18, 2019 at 02:20AM by Usbac

Any good simple Github repository showing you how to use RabbitMQ in a node.js application?

Looking at a simple example is the fastest and most efficient way of learning to do something, so I am wondering if there's anything on Github that may help me get a good hold of how to implement a message-broker for a node.js application.

Submitted December 18, 2019 at 01:44AM by jesusscript

I've finally published v1.5.0 of admin-bro (admin panel for Node.js apps) with file upload. Check it out!

https://softwarebrothers.github.io/admin-bro-dev/

Submitted December 17, 2019 at 10:23PM by hotcto

PDFKit Tutorial | Generating PDF Documents in Node.js and Browser

https://youtu.be/46c__islxCg

Submitted December 17, 2019 at 05:41PM by coderchrome123456

I am really new to Node.js and need someone's help to figure something out.

I wanted to create a thing which would synchronise two video players. I decided to AJAX first but it was of no good. Then I decided to "learn" Node.js just to create the application. I followed some tutorials to create the application on the localhost and everything works fine, but I still lack basic knowledge, so I can't set the application on my main website. I have tried everything, but nothing seems to be working. Would someone be willing to help me out?

Submitted December 17, 2019 at 05:05PM by _-__-_-__-__-

Build a server monitoring app using Node & Angular

https://codesource.io/build-a-server-monitoring-app-using-node-angular/

Submitted December 17, 2019 at 05:11PM by deven_rathore

What's New for Node.js in 2020

https://youtube.com/watch?v=mgBTY_SZRUk

Submitted December 17, 2019 at 04:39PM by reverentgeek

My Sequelize Tutorial

Hey everyone! I was looking for a community to post this into and found r/node. If this isn't an appropriate post for the subreddit, please let me know! I picked r/node because there isn't a Sequelize subreddit and Sequelize required Node.I built a tutorial revolving around using Sequelize, primarily for beginners, and would like some feedback on my tutorial. I've asked colleagues and friends for feedback, and so far it has been positive. I'm looking for a wider audience to give me feedback, since I want to make my tutorial the best it can be. I've put a lot of effort into writing this and am looking for constructive criticism. Before submitting feedback, please understand it is still a work in progress! A lot of Sequelize functionality is still missing from it, such as deleting information from a table, deleting data from associations, many to many associations, and so on.https://github.com/rlorenzini/mySequelizeTutorialA little background for those who are curious. I am a new developer (just over 1 year of coding experience) who went through a bootcamp in Houston. Once I graduated, I became a teacher's assistant. When we started covering the backend (Node.js, Express, pg-promise, Sequelize, postgreSQL, and more) a lot of students were struggling with Sequelize. Personally, I love Sequelize. I never liked creating a bunch of functions to run pg-promise commands when there was a library which already did that for me. I also struggled to grasp pg-promise at the time, so I gravitated to Sequelize.When I asked some students, they told me the documentation was confusing and difficult to follow. The Sequelize documentation is extensive with literally everything, but I never go there because it is written so poorly. I always went to alternate websites or medium articles to get help with Sequelize. One student specifically said, "Why is there no good single source for Sequelize?" It dawned on me I could be the one to make such a thing. Thus, my tutorial was born!I've been working on it consistently as a sort of pet project / passion. I've always enjoyed writing documentation and reports, but technical tutorials are new to me. That's why I'm here asking for feedback! Thanks in advance.

Submitted December 17, 2019 at 03:44PM by potatoCoding

34 most popular GitHub JS repositories in November 2019

https://medium.com/Iren.Korkishko/34-most-popular-github-js-repositories-in-november-2019-d03f34a30de6?source=friends_link&sk=db0052cc0cccbc9091c4fa78eb17282b

Submitted December 17, 2019 at 01:42PM by Fewthp

Admin system for Node?

I'm using express , mongoose and ejs. And I'm trying to make a cool science website(like https://www.livescience.com/).It's hard to make posts without admin system(like django admin or strapi). I wonder , Is there an admin system for node js? I make articles but i can't space between lines . I need a rich text editor to save to mongoose. Can you help me about it ?I used Froala. But I couldn't figure it out how to save texts.

Submitted December 17, 2019 at 01:07PM by Varenberg

What is the meaning of "normalizedArgsSymbol" in lib/net.js in node.js?

What is the meaning of "normalizedArgsSymbol" used in "function normalizeArgs(args)" defined in lib/net.js in node.js?

Submitted December 17, 2019 at 01:28PM by procastinator_10

Do you develop-on or only deploy-to Kubernetes

Kubernetes has been making waves! I suppose many are including it in their workflow. But is it a part of your development cycle? or is it only a deployment target ?

Submitted December 17, 2019 at 01:05PM by ak_kim0

Litekart - Fastest Javascript Ecommerce using Svelte/Sapper

Litekart is the fastest e-commerce built using javascript fullstack (NodeJS + MongoDB). The server rendered mode increases the SEO power of the e-commerce. Attach any e-commerce backend and you are live. For a live running ecommerce using the technology have a look at HopyshopyBuilt for speedFollowing are the test results when all servers (Elasticsearch, Node, Static Server, Client) give a ping response <100 ms. The demo app hopyshopy.com is hosted at Mumbai (India), If you are testing from another country, the results my vary.Solution to the above issue is to use a CDN. I am trying to find sponcers to migrate all to a CDN in near future.Google Lighthouse/Pagespeed Audit Score (Search Page)​https://preview.redd.it/36p7cl3a96541.jpg?width=1086&format=pjpg&auto=webp&s=96634e59af0fa2bc61f024300b29657614de2724Google Lighthouse/Pagespeed Audit Score (Detail Page)​https://preview.redd.it/rfffgm0b96541.jpg?width=1077&format=pjpg&auto=webp&s=340a02947a4ad8e03e527f7c94c7a805cb2bc112What is Litekart?Litekart is a storefront for your existing eCommerce.It is possible to connect with any eCommerce backendNo need to make a big leap or invest huge amount. Just take this opend source project and attach to existing backend.InstallationInstall - NodeJS - Yarn - Gitgit clone https://github.com/itswadesh/sapper-ecommerce.git cd sapper-ecommerce yarn yarn dev Thats all !Open http://localhost:4400 on chrome. Your app should be liveDeploymentSetup devops/live.js (Change according to your hosting envirnoment)const PM2_NAME = 'h' const REMOTE_DIR = '/var/www/hopyshopy/www' const REMOTE_HOST = '165.22.222.60' const REMOTE_USER = 'root' Rename sample.env to .env and enter your server private keyNextyarn live ​https://preview.redd.it/o2vapr6m96541.jpg?width=433&format=pjpg&auto=webp&s=dd87353fa91f06f03b69a06543910750bdf70b9bConfigurationsIf required change src/config.jsaccording to your requirementFeaturesTailwindCSS IntegratedServer RenderedProxy + API integratedLazy loading imagesAnimations (Page transition)LoginCart & CheckoutSettings from databaseStoresSEO optimized pagesCarousel (Slider)Loading IndicatorsComponentized Checkbox, Radio, TextboxInstant SearchFaceted filters1 click deploy to live serverAPI callsSkeletonsResponsiveFontawesomePWA>90PWA scorefilters: First, Date, Truncate, CurrencyGenerate production version files with css minifiedPUT, POST, DELETE calls with Bearer AuthorizationStoring tokens into cookieLoader on route change with 100ms delayIntegrated Google Analytics

Submitted December 17, 2019 at 10:47AM by itswadesh

nodejs contact form success message

hope someone can help....here's the code on app.js:app.post("/send", (req, res) => { const output =

You have a new contact request

Contact Details

  • Name: ${req.body.name}
  • Email: ${req.body.email}
  • Website: ${req.body.website}

Message

${req.body.message}

;​contact form:


On my localhost environment I get the Success feedback msg. But online (deployed on webserver), I don't see anything. Any ideas?

Submitted December 17, 2019 at 10:57AM by nightcrawler99