Tuesday 31 July 2018

Good resources for becoming a Node Developer from a PHP Developer?

I am looking at job opportunities right now and would ideally transition from a senior full stack LAMP developer to MEAN (or some node based stack). I think it would be a pretty easy transition and enable me to grow professionally because I am pretty experienced writing server side applications in PHP and have done a lot of front-end javascript, in many cases node modules that were browserified.I had a phone screen today with a company that seemed great - but I'm worried they may not want to pursue me because they need a node developer and I am really not one, despite having lots of experience that is pretty close and a good knack for learning new things.I feel like the biggest challenge in the transition would be dealing with concurrency issues which I grasp conceptually but haven't had to deal with in real life.Does anyone have any suggestions for trying to improve my skills and knowledge a bit so that i'd be more desirable to a node shop?I feel like the obvious answer is to just build an application in node but I am also in the middle of a personal project to build up my experience with AWS so I want to get further along in that project first and my current job leaves me little free time for the last month or two.Something more like a book or just general advice from people who've made a similar transition would be very helpful.

Submitted August 01, 2018 at 06:02AM by _unicorn_irl

Nuxt with Loopback and Vue

Would this confer certain disadvantages over other options?

Submitted August 01, 2018 at 02:44AM by 5alpha-reductase

How much does my Lambda function cost?

https://ift.tt/2v5gm0C

Submitted August 01, 2018 at 02:20AM by ranrib

Building a Video Converter with Node.js and React

https://ift.tt/2OxSRWn

Submitted August 01, 2018 at 02:21AM by waleed_ahmad

I have ten individual node packages (microservices) in ten separate repos. I would like to merge them into one, unified package. Each individual package would also depend on the unified package. Possible?

Ten microservices, some of which depend on each other (eg. User, TodoItem, ...). Currently, each microservice has its own repo and npm package. I would like to merge them into one npm package while maintaining individual repos (open to opinions on that choice, though)Each microservice will provide interface code so that other microservices can call it//Code owned by the TodoItem microservice. Can be called from other microservices // TodoItem/index.ts const addTodo = (someDescription: string) => {...} const removeTodo = (todoId: string) => {...} export { addTodo, removeTodo } Currently, I can import the TodoItem code from my private npm package:import TodoItem from '@user/TodoItem' However, I would like to use the "aws-sdk" approach, where all of my packages are bundled:import { TodoItem } from '@user/my-app-sdk'; The "my-app-sdk" node package would really just import the various microservices and then export them. Something like://my-app-sdk/index.ts import TodoItem from '@user/TodoItem' import User from '@user/User' export { TodoItem, User } Is this possible and practical? Bad design? Am I in for circular dependency hellscape?

Submitted July 31, 2018 at 09:10PM by 8solutions

Which hosting service would you recommend for a webhook bot?

We have a Facebook bot running on Node.js, using webhooks/express HTTP. Currently it's hosted on glitch.com but since it's a free service, it has its limits.We're looking for a paid hosting service that works well and is easy to set up, possibly like Glitch.com, without requiring experience in this hosting stuff.Thanks for helping out!

Submitted July 31, 2018 at 05:45PM by matharooudemy

Parcel with static assets

Hey people all i wanted is to use parcel to bundle all my css/js etc for production. My whole site is static and i didn't use any package manager (its a template i bought online that includes the scripts, dependencies and styles) .The problem is, when i run parcel index.html it attempts to install all the packages via npm and gives 404 error on bootstrap.min.css@latest for example. (it also doesn't install the right version of dependencies but the latest)Im new to parcel and never had npm errors out of nothing. What could be the issue here?Below is the log:0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\...\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install', 1 verbose cli 'bootstrap.min.css', 1 verbose cli '--save' ] 2 info using npm@5.6.0 3 info using node@v8.11.0 4 verbose npm-session 8f031dc15bf54c82 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 http fetch GET 404 https://ift.tt/2LGNeHp 1069ms 8 silly fetchPackageMetaData error for bootstrap.min.css@latest 404 Not Found: bootstrap.min.css@latest 9 verbose stack Error: 404 Not Found: bootstrap.min.css@latest 9 verbose stack at fetch.then.res (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19) 9 verbose stack at runCallback (timers.js:794:20) 9 verbose stack at tryOnImmediate (timers.js:752:5) 9 verbose stack at processImmediate [as _immediateCallback] (timers.js:729:5) 9 verbose stack From previous event: 9 verbose stack at regFetch (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:36:6) 9 verbose stack at fetchPackument (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:81:10) 9 verbose stack at getManifest (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:37:10) 9 verbose stack at manifest (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:24:10) 9 verbose stack at Object.manifest (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\index.js:12:12) 9 verbose stack at Object.Fetcher#manifest [as manifest] (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\protoduck\node_modules\genfun\lib\genfun.js:15:38) 9 verbose stack at manifest (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetch.js:16:18) 9 verbose stack at pinflight (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\manifest.js:24:12) 9 verbose stack at C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\promise-inflight\inflight.js:29:24 9 verbose stack From previous event: 9 verbose stack at _inflight (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\promise-inflight\inflight.js:28:25) 9 verbose stack at C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\promise-inflight\inflight.js:22:14 9 verbose stack at runCallback (timers.js:794:20) 9 verbose stack at tryOnImmediate (timers.js:752:5) 9 verbose stack at processImmediate [as _immediateCallback] (timers.js:729:5) 9 verbose stack From previous event: 9 verbose stack at inflight (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\promise-inflight\inflight.js:14:40) 9 verbose stack at Object.manifest (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\manifest.js:22:10) 9 verbose stack at fetchPackageMetadata (C:\Users\...\AppData\Roaming\npm\node_modules\npm\lib\fetch-package-metadata.js:58:10) 9 verbose stack at limited (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\call-limit\call-limit.js:29:10) 9 verbose stack at fs.stat (C:\Users\...\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:219:20) 9 verbose stack at C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 9 verbose stack at FSReqWrap.oncomplete (fs.js:152:21) 10 verbose cwd C:\Users\...\Documents\TreehouseWebsite\nova 11 verbose Windows_NT 10.0.17134 12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\...\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "bootstrap.min.css" "--save" 13 verbose node v8.11.0 14 verbose npm v5.6.0 15 error code E404 16 error 404 Not Found: bootstrap.min.css@latest 17 verbose exit [ 1, true ]

Submitted July 31, 2018 at 06:21PM by croxcrocodile

Use native v8 inspector to generate coverage reports

https://ift.tt/2Ma7E7G

Submitted July 31, 2018 at 06:40PM by Eywek

[x-post]Looking for some feedback

Hey everyone,I made a web app that is a character tracker for a Legend of Zelda D&D Homebrew and was hoping to get some feedback about it. This is practically the first version of release with working features (though I'm sure I'm missing something or functionality is broken somewhere). You can view the website here, the GitHub repo here, and the Trello board here. Let me know if this breaks any of the subreddits rules.

Submitted July 31, 2018 at 05:09PM by PerfectOrphan31

🔒UPASH - Painless password hashing API

https://ift.tt/2FiU66u

Submitted July 31, 2018 at 04:08PM by simonepri

I’m looking for an NPM package that mutates neural networks for neural evolution

I’ve seen a lot of packages, like neataptic, that use architecture-free networks and create new generations automatically. I want to control each generation, and each mutation happening with simple clone() and mutate() methods. Can anybody point me to a package? It would also be preferable if I can save the neural net to JSON.Thanks!!

Submitted July 31, 2018 at 02:06PM by blake_sanie

Building a Video Converter App with Node.js, Express and React

https://ift.tt/2OxSRWn

Submitted July 31, 2018 at 02:30PM by waleed_ahmad

Introducing Clinic Bubbleprof, a unique way to visualise Node.js code

https://ift.tt/2LHSQkE

Submitted July 31, 2018 at 01:05PM by themaven

NodeJS ❤️

https://ift.tt/2LEaRQJ

Submitted July 31, 2018 at 11:12AM by MarcosPortoX

Great Node developer course by Andrew Mead! It guides you through the basics all the way to writing a real-time web application.

https://ift.tt/2LFSZFl

Submitted July 31, 2018 at 09:58AM by usualyprogramming

Why the New V8 is so Damn Fast

https://ift.tt/2NCNzrd

Submitted July 31, 2018 at 09:52AM by gy0p4k

From express to Koa

https://ift.tt/2AsVYvI

Submitted July 31, 2018 at 09:33AM by onig90

Monday 30 July 2018

Bulk SMS in Bangalore

In the competitive market bulk SMS is more useful and more beneficial in the competitive level standard & helps the company to promote the business at the top level & increase the standard of business to fight with other company.Online SMS Shop is an ISO 9001-2008 Certified Bulk SMS in Bangalore and Global Digital Marketing Service Provider in terms of SMS and Whatsapp solutions.Call now for free Demo +91 – 9039063936.

Submitted July 31, 2018 at 06:34AM by onlinesmsshop

this doesn't work, why?

var http = require('http');var formidable = require('formidable');var fs = require('fs');http.createServer(function (req, res) {if (req.url == '/fileupload') {var form = new formidable.IncomingForm();form.parse(req, function (err, fields, files) {var oldpath = files.filetoupload.path;var newpath = 'C:/Users/Your Name/' + files.filetoupload.name;fs.rename(oldpath, newpath, function (err) {if (err) throw err;res.write('File uploaded and moved!');res.end();});});} else {res.writeHead(200, {'Content-Type': 'text/html'});res.write('
');res.write('
');res.write('');res.write('
');return res.end();}}).listen(8080);

Submitted July 31, 2018 at 06:38AM by smiles_low

ik this is a noob question but I'm asking it

How would I pass the data from an html form to a node js app?

Submitted July 31, 2018 at 06:05AM by smiles_low

using nodeenv to install parcel but it skips fsevents@1.2.4 ?

Hi!I am new with node and I felt like using nodeenv to try some tools and try to learn how to benefit with them. node version is v10.7.0 npm version is 6.1.0When I tried to install parcel with nodeenv I got this npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/parcel-bundler/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) Is this bad? Why might this occur?

Submitted July 31, 2018 at 05:30AM by tassulin

Why does everyone say to use node with mongo/nosql rather than an sql database

No text found

Submitted July 30, 2018 at 11:56PM by smiles_low

Taskbook - Tasks, boards & notes for the command-line habitat made with nodejs

https://ift.tt/2v4JepI

Submitted July 31, 2018 at 12:33AM by ohaiomasta

Debugging Help: Infinite loop caused by seemingly accepted and rejected promises...at the same time?

This is the offending code. I've been using callbacks somewhat successfully, but I am new to promises.download is from https://ift.tt/2vhRXEz understanding is that the .then code will be executed if the download is successful, 'exclusive or' the .catch code will be executed if the promise is rejected. Which would imply that a .catch should not run immediately after a .then, but that is exactly what is happening in my output.function getData(callback) { download(downloadUrl).then((xmlData) => { parseData(xmlData, callback); }).catch(retryDownload(callback)); }function retryDownload(callback) { console.log('Error downloading xml data.'); setTimeout(() => { getData(callback); }, 300); }console output is: 1. Sucessful parsing output 2. Error downloading xml data. 1. 2. 1. 2. etc to infinity.Any ideas? Perhaps I misunderstand promises?

Submitted July 30, 2018 at 11:15PM by Palmoftheface

Help debugging performance issues

Hi everyone,I've been dealing with trying to debug a performance issue for the past few days that seems to be CPU bound but I am having a hard time telling if the issue is what I actually think it is. I've been using the debugger with chrome://inspect to run CPU profiling and have being reading many articles that tell me that the "wider" the graph bars on the chart are, the more likely those functions are to block the event loop.It appears to be a function that calculates the string distance of two strings but I am not entirely sure if I am reading the chart and other options in the profiling correctly.Does anyone have any tips on how to debug NodeJS apps for performance issues? Has anyone dealt with having to offload some processing power via webworkers or other libraries or switching some functions to AWS Lambda to avoid problems like these? I can post the cpuprofile file later when I have access to my work computer if that helps.

Submitted July 30, 2018 at 10:40PM by sil3ntki11

You ever have something you want to code but can’t be bothered. Like literally I’ve been bashing out the frontend and react is awesome, but now it’s time to do the backend and I really can’t be bothered...

I currently work as a labourer (it pays well, and I sleep well for once), so I’m too tired to do anything complex like backend work when I get home, and the weekends I’m normally still somewhat tired after a week of hard work, so usually I just do frontend work. But now there’s no more to do and the backend needs doing, but I just can’t motivate my self to do it. I’m thinking I may be losing interest in programming - again. If so, any tips to regain interest? Thanks a lot!

Submitted July 30, 2018 at 09:41PM by OzziePeck

Passport.js: two strategies, serializing/deserializing twice. Can't get to use both strategies but only one.

So I've been spending the past few days trying to understand why the hell I couldn't keep an user logged in once authenticated even though authentication itself was working.By trying to fix the issue for hours, I finally got what's wrong.The issue is the following: I have two different passport strategy, so I am serializing and deserializing the user twice. If I serialize the user with the local strategy first, local strategy will work, but google's won't. And viceversa.I put a comment to highlight the problem in app.js.You can find the code here: https://ift.tt/2Apyibj knows how to solve this? I've literally been stuck with this for days and I've finally come close to a solution, but I can't seem to find it.

Submitted July 30, 2018 at 08:49PM by mindnoot

mid to large sized projects (npm packages) that use ES6 classes syntax

I wanted to peek a little into mid to large sized projects to look at their code, how they structured their project ... to learn and adopt it for my personal projects.tbh i didnt do a hour long search for those sort of projects but some google search aswell as npm/github but most of the larger packages seems to be created before ES6 classes where production ready and some newer packages use typescript instead of "old" js.1.) Some of you guys have some favs where you think that they have implemented classes the right way? (please dont discuss if you should use classes or not like eric elliot says ...)2.) Do you think typescript is the way to go for new projects in particular when you create production grade code for companys?3.) if you think ts is the way to go, which projects do you think are worth to take a look at?

Submitted July 30, 2018 at 08:19PM by pinkeyAT

Which one is more suited for a production use case ts-node or tsc?

Hello I am using docker and would like to know which one is preferred (tsc or ts-node) for production use cases. Thanks guys.

Submitted July 30, 2018 at 05:39PM by littuelPrincess

How to detect if file is being written to

Trying to find a solid solution to detect if large files are being written to by another program/user. I have a method that works, but is potentially error prone (putting a fs.renameSync(file, file) function in a try/catch). Placing a file size check in a timeout will return inconsistent results as apps all write to files in different intervals, also slows down quite a bit when processing lots of files. Also lsof command won't work in this scenario cause I'm accessing network files that could be written to by other computers. Let me know if you guys have any ideas for this. Thanks!

Submitted July 30, 2018 at 05:49PM by justin2taylor

Is there a way to tack on query params/modify the request URL in axios using redux?

I am making a lot of the same kind of requests in axios with an authentication token I use to authenticate to my API and it's becoming tedious writing it in every time I want to add another. Is there a way to write some middleware in redux to tack on the token to the query params before the request is actually made?

Submitted July 30, 2018 at 06:08PM by Jag783

Where is the best place to store a temporary file, that I need a consistent path for across all platforms (windows, mac, linux)?

So, I'm using node for a program that syncs your clipboard to a docker container's clipboard, and I need to create a file that is in the same location so that it can be shared in a docker bind mount, whether I'm on windows, mac, or linux. So, naturally, the file needs to have the same path on all those platforms. The file doesn't have to be persistent on starting or restarting though, as all it does is share a clipboard between the host and container. Any suggestions?

Submitted July 30, 2018 at 06:33PM by zwhitchcox

Enforcing a single web socket connection per user with Node.js, Socket.IO, and Redis

https://ift.tt/2LN7VAE

Submitted July 30, 2018 at 04:28PM by mariotacke

REST api with SAML authentication

I’ve built REST apis using JWT and basic-auth in expressjs. I was wondering if it is possible to authenticate a REST api using SAML 2. Has anyone tried this? If so could you point me to some reading material? Or explain how?

Submitted July 30, 2018 at 04:45PM by TG__

Using JSON Web Tokens to Authenticate users and protect API routes

https://ift.tt/2OucYVl

Submitted July 30, 2018 at 02:33PM by skidmark_zuckerberg

parse the http response of type non json for a specific field and its value.

i have a node js app that makes http request , whose response is of type text . Reponse contains balance of account as the last few words of the text.Balance : 2423423 , unlocked balance : 1324How can i parse such data to send only balance and unlocked balance to the client ?

Submitted July 30, 2018 at 11:21AM by SilverExit

Changing sequelize primary_key name and type

NPM scripts runner with fuzzy matching

Ever been tired of typing those long npm run build-production:qa -- --secret 123456 again and again?I did, and took some time to write a tool that allows you to just write nr bpq --secret 123456 (even works with typos), because I'm lazy.If it can be useful to some other fellows, it's here: https://ift.tt/2K7r4IA wish something like this becomes integrated by default someday...And BTW it supports Yarn instead of NPM if that's your thing, it's cross-platform and has a (basic) API if you want to integrate it in your own CLIs.Feedback welcome :)

Submitted July 30, 2018 at 08:02AM by sinedied

Sunday 29 July 2018

CronJob not running daily

Response type is Cors??

I'm working on a react app that grabs an AWS S3 presigned URL from my node api so that the front end can upload an image to a bucket. In my node api I can console log the presigned URL but when I return it to the react app the response is of type "cors".I've set Cors rules in AWS, I've give the user write access to the bucket, I've add the cors package to my node app and installed the cors addon for the browser but I still can't get it working. Anyone have a suggestion?

Submitted July 30, 2018 at 02:39AM by worstaccountnamehere

Question: How to test async callback parameter?

Trying to test within the exec functions callback parameter but can't work out for the life of me how. What exactly am I missing?Test-framework I'm using is jest if that helps.fnc() { const childProcess = this.exec(cmd, (error) => { if (error) { throw error; } }); } Thanks in advance of any help or guidance.

Submitted July 29, 2018 at 10:34PM by MartialArtGains

All you need to know about the Web Audio API

https://ift.tt/2KawlPE

Submitted July 29, 2018 at 05:30PM by thickoat

How to run Node-Excel-Export module?

Hello,I am trying to use Node-Excel-Export to generate an Excel spreadsheet based on user input and data pulled from API, but am having some trouble figuring out how to actually get the file generated so the user can download it.Right now I have it in its own module and am then requiring it in my main file.Any ideas on this, or has anyone worked with this module before? Thank you!

Submitted July 29, 2018 at 04:30PM by OgunNova

compile error on raspberry pi

I am attempting to run "nvm install 0.10.25" as per the install doc of some software I intend to run on a Raspberry PI 3B+ running Raspbian 9. Compilation fails :deps/v8/tools/gyp/v8_base.target.mk:225: recipe for target '/home/pi/.nvm/src/node-v0.10.25/out/Release/obj.target/v8_base/deps/v8/src/accessors.o' failedmake[1]: *** [/home/pi/.nvm/src/node-v0.10.25/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1make[1]: Leaving directory '/home/pi/.nvm/src/node-v0.10.25/out'Makefile:38: recipe for target 'node' failedmore output - https://ift.tt/2K5Bs3G not sure where to begin troubleshooting this so any tips would be appreciated

Submitted July 29, 2018 at 04:33PM by dank_memestorm

What message queues are you using?

I’m searching for a message queue that is easy to integrate in my existing system built on MEAN stack, built in Typescript, and deployed to Heroku

Submitted July 29, 2018 at 04:33PM by Genereux2018

Express setup to handle deep linking...?

Hey friends, Been spinning up an Express API server which is also delivering the Angular6 client side bundle (MEAN6-ish?).I've got no problem with the routing when clients start on the root of the site, however I noticed that "deep links" directly into the app (which the Angular routing should be handling) is not working right...The closest workaround I came up with is to use a wildcard...but just wondering if there's anything I missed or could structure better?If I wanted to add static pages later on, separate from the client handler, could that work as well?// setup our API route app.use('/api/v1', apiRouter); // add the "public" folder to the static handler app.use(express.static(path.join(__dirname, 'public'))); // future request - a static handler for /privacy -- ? app.use('/privacy', (req, res) => { send('privacy'); }); // add the wildcard to catch / as well as deep links to /this/is/a/deep/deep/link app.use('*', express.static(path.join(__dirname, 'public'))); Any tips or advice is appreciated - thanks

Submitted July 29, 2018 at 04:19PM by wazoocakes

Cartilage - Request validation express

Cartilage validates incoming request schema. Its is simple, async and lets you validate http headers, body, params and even query. Just write your validation schema in joi, and let cartilage handle the rest as a middleware.https://ift.tt/2mRMMaD

Submitted July 29, 2018 at 03:02PM by uzill

Would you push to use NodeJS to write the COM sub-module of an enterprise application? Is it a safe choice?

I’m in a unique position. I’m the chief tech lead in my company (small software house) and I’m currently designing the architecture of an enterprise application for an important multinational client.One of the things the application has to do is manage the upload of huge files via browser and store them on disk, so my first go-to, for this specific task, was NodeJS. Other modules will be written in .NET or Java.One of my team members, however, pushed pretty hard to stop me from using NodeJS at all. He put forward several objections ranging from:his distaste for the language (“JavaScript is designed for the browser, not the server”)to security considerations (“an ex coworker of his who does security consultancy told him to stay away from NodeJS”)to “using this tech may make us look bad if the wrong people on the client’s IT find out”, given it’s not “enterprise like Java or .NET”He comes from a Java/C++ background which make him despise everything that’s not “as formal” as those ecosystems. I shut him down quickly when I saw he was being biased, but I took the last two points (security and enterpise-level) seriously.I’m still benchmarking based on our needs in order to choose the best tech among .NET, Java or NodeJS (which he would have done if I haden’t told him to), and because this is my project, I’ll decide what we use.However, the technical objections put forward are still looming in my head. The decision may be mine but I always consider my team’s opinion, and he put a lot of self-doubt on my original assessment, making me doubt of myself to a point.What do you think? Should I have not considered NodeJS for an software of the sort?

Submitted July 29, 2018 at 02:13PM by Katej99

Increasing an NPM package’s search score – Medium

https://ift.tt/2Ly1iTB

Submitted July 29, 2018 at 11:38AM by jsloverr

"SyntaxError: Unexpected token ("

Hi, I'm new to node and im trying to use rss-parser : https://ift.tt/2K6BRTv just trying to run the code they have on the site:let Parser = require('rss-parser'); let parser = new Parser(); (async () => { let feed = await parser.parseURL('https://ift.tt/2mPSgm3); console.log(feed.title); feed.items.forEach(item => { console.log(item.title + ':' + item.link) }); })(); and i get the error unexpected token. i'm using node 6.2.0 i'm unsure where to put my file. right now i have a folder with my .js script and another folder called node_modules with all the modules inside.Thanks ahead

Submitted July 29, 2018 at 09:40AM by Ryan_Bingham

Passport.js: authentication seems to work fine, but can't keep users logged in.

I've build a simple app that allows users to log in through google using passport's google strategy and it all works fine.I'm trying to add a local strategy as well, but I can't find a solution.Database works fine as users get created during sign up process.Logging in seems to work initially as I get redirected to "/" as expected with successRedirect: "/". But if I try to go to any other route page, I'm not logged in any longer.I f i run req.isAuthenticated()it returns false. If I try to retrive req.user, it's undefined.Here's the code: https://ift.tt/2uZ43Dc, I tired to get some help on stackoverflow but with no success)It seems like authentication itself works, but somehow it doesn't keep up. If I run a console.log("req.isAuthenticated") right after signing up it returns true, but as soon as I go to another route (example: /), by running a console.log("req.isAuthenticated") in the get request of that route I get a false. It's like I can login but I can't stay logged in. Could this be related to cookies? Did I write something wrong? Does anyone know how to solve?

Submitted July 29, 2018 at 09:17AM by mindnoot

Saturday 28 July 2018

Npm module for easy ipc communication between parent and child processes using RxJS in NodeJS.

https://ift.tt/2NSvoh7

Submitted July 29, 2018 at 05:59AM by alex-ald

Basic Password Protection Help

I'm trying to have a webpage have a basic password lock. I don't want users or a database, just if you have the right password, you get in. Any ways to do this? Every google search is coming up with full on authentication. Am I missing something? I'm making an express app. Pretty junior / beginner dev.

Submitted July 28, 2018 at 09:15PM by c-michael

Error handling with express

Hi, I am a beginner in node. Recently I started building a website where signed in users can upload images. I use multer for that, I also set the max file size to 5 MB. When the file size is bigger than that multer throws an error. I tried doing some error handling (I am completely new to this). I built this simple middleware function:function error(err, req, res, next){ res.json({ message: err.message }) } This works but the problem is that when the error occurs this json data is displayed in the browser window:{"message":"File too large"}What I want to do is refresh the whole page with the error message displayed somewhere on my page. How can I do that? Also could someone please explain how error handling works cause i am very confused?Thanks in advance :)

Submitted July 28, 2018 at 07:52PM by everek123

[HELP] req.flash() requires sessions but sessions exist already

I am trying to just hit a simple `/` route and use `res.send()` to make sure it works. I am getting `req.flash() requires sessions` but I already have sessions set up using a Redis instance.I have spent about 2 hours on Stack overflow trying to find a solution, I have tried many things and nothing has worked. Please so not link to a post saying duplicate unless you know for sure it is the solution.**App.js**const express = require("express"),app = express(),mongoose = require("mongoose"),session = require('express-session'),flash = require('express-flash'),RedisStore = require('connect-redis')(session),bodyParser = require("body-parser"),passport = require("passport"),LocalStrategy = require("passport-local"),methodOverride = require("method-override");// Modelsconst User = require("./models/user");// Configurationconst config = require("./config/config");mongoose.connect(config.db);app.use(bodyParser.urlencoded({extended: true}));app.set("view engine", "ejs");// set sessionapp.use(session({resave: true,saveUninitialized: false,cookie: {maxAge: 60 * 1000 * 60 * 24 * 30 // 30 days},secret: config.sessionSecret,store: new RedisStore({url: "redis://localhost/sail",auto_reconnect: true})}));app.use(express.static(__dirname + "/public"));app.use(methodOverride("_method"));app.use(flash());// PASSPORT CONFIGURATIONapp.use(passport.initialize());app.use(passport.session());passport.use(new LocalStrategy(User.authenticate()));passport.serializeUser(User.serializeUser());passport.deserializeUser(User.deserializeUser());app.get('/', (req, res) => {res.send('hello world');});module.exports = app;

Submitted July 28, 2018 at 07:43PM by jsdfkljdsafdsu980p

How to server-side render React, hydrate it on the client and combine client and server routes

https://ift.tt/2LTjqU1

Submitted July 28, 2018 at 11:39AM by MarvelousWololo

Making a multiplayer blockchain game using Phaser, NodeJS and Ethereum — Pt. 2 - Medium

https://ift.tt/2AewSk8

Submitted July 28, 2018 at 12:28PM by Fewthp

Terminalizer 🦄 Record your terminal and generate animated gif images

https://ift.tt/2A67InH

Submitted July 28, 2018 at 09:27AM by ac905e0771

Best way to install Node.js on a new (macOS) computer

Hi, everyone,On my previous Mac I originally installed the binary from the Node.js website and then, after some time, moved to using nvm (and then n, as nvm was pretty slow when opening a new shell). I'm setting up a new Mac now and I'm wondering what's the best way to do it. I also recall, at one point, setting up a Mac where I installed the binary from the website and then brew was complaining that node had files in _/usr/local/include_. Not that it caused any problems or anything, though.I know I can also install via Homebrew. I understand that the answer is "do what's best for you" but I'm interested in some thoughts and opinions from others.Thanks!

Submitted July 28, 2018 at 08:12AM by bogguw

Friday 27 July 2018

Can anyone help

Let say you have an event happening every second. But you only want your function to trigger every 3 seconds, how would you do that?

Submitted July 28, 2018 at 07:36AM by nosebleed_tv

Deep Learning in JS

https://www.youtube.com/watch?v=SV-cgdobtTA

Submitted July 28, 2018 at 04:47AM by fagnerbrack

Developer Guide: AWS Lambda + SQS

https://ift.tt/2AhFuWY

Submitted July 27, 2018 at 08:51PM by nshapira

will process.hrtime() always be unique?

is there ever a possibility process.hrtime() could ever be the same even if called as fast as possible within the same running script?

Submitted July 27, 2018 at 07:47PM by DaSpawn

Node.js For MySQL Book

Anyone know of a good book that covers how to incorporate Node.js for MySQL?

Submitted July 27, 2018 at 08:22PM by SecretAgentZeroNine

Unable to upload image larger than 5MB on a nodejs app with nginx.

Hey everyone! I'm developing a nodejs app but there's a problem when I put the app online.I have a form where it's possible to upload an image, and in localhost it always worked correctly, but now in Google Cloud Platform instance it isn't working.I am using nginx as a proxy for port 3000 which is where I have the nodejs app running.Initially, 'Error 413 Request Entity Too Large' occurred, but I was able to solve this by adding the lineclient_max_body_size 10M;to the nginx.conf configuration file.The problem now is that when uploading images larger than 5MB, error 413 is not returned, but image uploading is not done either.PS: I use the formidable to handle the data received from the server side.

Submitted July 27, 2018 at 05:56PM by ashestosnow8

How do you handle login credentials with puppeteer?

Do I just give it plaintext user and pw to type into the fields?I will definitely make another file to hold them and .gitignore so they're not out there, but are they vulnerable anywhere while running a script?

Submitted July 27, 2018 at 04:25PM by thedawgbeard

Problem with static files

Hi, I have an express app where users can change their profile image by uploading a photo. I use multer to do that. The picture's path is stored in the user's DB record (path is assets/uploadedImages/randomImageName). I use the path as the images src. In order to serve the folder with those images as a static file i tried doing app.use('/assets/uploadedImages', express.static('./assets/uploadedImages')). This works great for routes such as my home page localhost:3000, but when i have something like localhost:3000/users/userId this method stops working. I guess this is because of the / i have after users. How can i solve this issue?Thanks in advance ;)

Submitted July 27, 2018 at 03:16PM by everek123

Learn complete back-end development using Node.js [Tutorials]

https://ift.tt/2LUvZ1x

Submitted July 27, 2018 at 01:19PM by Monika_Manali

Making a multiplayer blockchain game using Phaser, NodeJS and Ethereum - Pt. 1

https://ift.tt/2Apu4Rl

Submitted July 27, 2018 at 01:46PM by Fewthp

Checklist: 23+ Node.js security best practices

We've tried to summarize and curate the top articles about Node security into a single checklist: https://ift.tt/2OiaJEi be glad to hear your thoughts and improve further.If you prefer the GitHub version, you can find it here

Submitted July 27, 2018 at 01:19PM by yonatannn

Implement gRPC for your NodeJS microservices.

In this post I write about the new, blazing fast library by Google, which totally changes the paradigm of how we do RPCs in microservices architecture. The post challenges the prevalent REST API model and provided reasoning to this new route. Finally, we also try to implement a very basic NodeJS application using our learnings. The post is divided into 2 parts as below -Part 1 - https://ift.tt/2LIC18v 2 - https://ift.tt/2LSy1PH I've just started writing my learning out. I'm learning in the open and would like any help out there. Please provide your feedback so that I can improve. If I've made any mistakes, please do point out. And do share if you like.

Submitted July 27, 2018 at 09:11AM by shobhit_c

Reinforcement Learning with Q-Learning in Node.js

https://ift.tt/2NNTgTe

Submitted July 27, 2018 at 09:20AM by Vincenius_

uws has again been broken.

background:https://ift.tt/2mOFCDW creator has done it again, this time publishing version 99.0.0, undoing npm @latest pointer fix, breaking projects depending on uws.

Submitted July 27, 2018 at 08:04AM by BenZed

Thursday 26 July 2018

if file requested is an mp3, stream it?

soooo right now when I try to play an mp3, the entire file will download, then play... there is like a 5 second delay... is there a way to stream the file so it starts playing almost instantly?

Submitted July 27, 2018 at 04:42AM by superfake123

HAPI - Route Handlers and passing additional data besides (request,h)

This is a snippet from my api.js that holds my api routes.Above this code is all the static route handlers. Auth/Login/EtcWhat you see below is the routes added dynamically based on my models.js which holds on the object classes that have api interfaces.I need to some how pass from the API call to the handler the class model to my db.js which holds the handler. Even just passing the name of the model I could resolve it by using models[model] in the db.js. Unfortunately this is seeming harder or more convoluted than I want.pre [] seems to happen at the time the route is called not when the api call is built so this causes issues with the model that gets passed into request.pre.model. The API call says it's path is /_api/Merge/Person but when it executes pre[] it doesn't pass the Person model. It passes the last model in the array which could be something like "Organization" and not "Person".for (var model in models) { routes.push({ method: 'POST', path: '/_api/Merge/'+model, options: { pre: [ { method: function () { return models[model]; }, assign: 'model' } ], handler: db.mergeObject.handler, description: 'Add/Update Object ' + model, tags: ['api'], validate: { payload: models[model].schema() } } }) routes.push({ method: 'DELETE', path: '/_api/Delete/' + model, options: { pre: [ { method: function () { return models[model]; }, assign: 'model'} ], handler: db.mergeObject.handler, description: 'Add/Update Object ' + model, tags: ['api'], validate: { payload: { key: joi.string().required() } } } }) } I'm not sure how to hard code a value in my routes. I thought I could use option.notes and store the object name but I felt like that was kind of lame and there could be a more sophisticated way of doing it.

Submitted July 27, 2018 at 12:56AM by Thriven

The Age of “Node.js and…”

https://ift.tt/2uSdu6m

Submitted July 26, 2018 at 08:45PM by _bit

console.log not printing the first character

I'm using 'net' to make a server. When a user connects, console.log works fine and prints how many clients are connected. When the client connects, it instantly sends a string to the server. The event that handles data on the server properly receives the string, but the console.log is supposed to print a "Recieved data" message. It prints, but the first letter is always replaced with a blank space. What's going on?

Submitted July 26, 2018 at 07:57PM by SonamuGames

Need somebody to hold my hand in getting my Express app online

I have a portfolio site online. I'd like to have it run with Node, so that I can have contact forms and other server-side functionality without having to touch PHP. So I wrote up everything offline first, using Express as a framework. The whole thing is effectively finished so I uploaded it all to my server via SFTP, npm installed the dependencies and so now it is on the server.The server's OS is Ubuntu, the HTTP Server is Apache. I know Apache is old, I'm a old man in a young man's body. It took me ages to move away from PHP in favour of server-side JavaScript. Plus this is only a portfolio site and not a real web application so I don't care so much about performance, I just want people to see how smart I am. Anyway I'm using Apache to serve requests and that is where I'm having trouble.I've been following this guide:https://ift.tt/2Ae3cn5 PM2, configuring Apache, etc. So now when you visit my website, you see a Apache file directory with the heading 'Index of /' and it is the /public directory familiar to all of you who use Express. So the root directory is the right directory. But it isn't starting the Node script. I don't know what could be wrong. Node isn't starting and running its script to set up the Express application.If anyone can ask me a few leading questions from a 'been there, done that' perspective, that would be brilliant and very helpful. I'm kind of stuck here.

Submitted July 26, 2018 at 08:24PM by koenigsforst

npm list --depth=0

I have a weird issue,Im doing npm list from my file which is being run by script. Long story short:let coreList = execSync('npm list --depth=0 --prefix core', { encoding: 'utf-8' }); Now on my linux env im getting this bullshit art " ├── " while on windows +--; I havent tested on macos and im guessing another poop there too:)now obv im doing some string modifications and parsing to make later on string into object and so on.. But wonderingIs there some npm list --nofuckingart function?Thanks:)

Submitted July 26, 2018 at 06:40PM by ProblemSolver7

Random lag while receiving webhook

I am receiving telegram web hook on a nodejs server.I can see a random freeze which lasts for 3+ seconds.This is the code:https.globalAgent.maxSockets = 100;https.createServer(options,function(request, response) {var queryData = "";request.on('data', function(data) { queryData += data;var urlencode = require('urlencode');result=urlencode(queryData);console.log(result);response.writeHead(200, "OK", {'Content-Type': 'text/plain'});response.end();});}).listen(8443, "0.0.0.0");When I send message, I see it instantly in the console most of the times but randomly there is a freeze.What could it be?

Submitted July 26, 2018 at 07:09PM by Sidlohchab

Mobius Network makes accepting cryptocurrency extremely easy in existing Node apps.

If you're interested in accepting cryptocurrencies on your existing or new web app, @mobius-network/mobius-client-js takes an hour or two at most to setup and start accepting crypto. Free, no fees, no middleman, pure Node.js package. Official docs can be found at https://ift.tt/2NJczNx. Happy Building!

Submitted July 26, 2018 at 04:42PM by mrtpain

FP Unit Testing in Node - Part 6: Next, Logging, and Conclusions

https://ift.tt/2v69FL6

Submitted July 26, 2018 at 02:32PM by Khancity

ap-npm: private authenticated npm repository

Hello everyone,About 1,5 year ago I started programming and almost immediately was fortunate enough to get a position at a small software company. In my time there I worked on a private npm repository as at the time the only available solution was Verdaccio (which has improved a lot since), but Verdaccio did not offer functionality for using your own authentication provider. ap-npm is written in Typescript and provides interfaces for AuthProviders and StorageProviders. By default it uses a json database for authentication and the filesystem for storing packages. It is highly recommended you at least implement your own authentication provider.Development stalled last year due to personal reasons, but I am proud to announce that this package is (finally) ready to be used. It is supposed to be used with npm-scopes, but can also proxy install and audit requests if enabled in the config. It does not cache packages like Verdaccio does, but this could be added in the future (pull requests are welcome).This is my first time publishing anything open source so any feedback is welcome :)Repository: https://ift.tt/2AbSWvE MIT

Submitted July 26, 2018 at 11:38AM by meirbon

Developing Real-Time Web Applications with Server-Sent Events

https://ift.tt/2NOkHwj

Submitted July 26, 2018 at 11:59AM by Ramirond

Want to talk about TypeScript? Join this slack group!

https://ift.tt/2JXqYTN

Submitted July 26, 2018 at 10:54AM by ower89

Wednesday 25 July 2018

Testing/Mocking request headers for Lambda function

I have a simple node app that will eventually become a Lambda function, used by API Gateway on AWS.In the real world Lambda/API Gateway usage, the request will be forwarding headers with authorization token to the Lambda function which it will need to authorize.So I am trying to understand the best way to mock this in local development as stand alone node app that will be easily transferable to Lambda function, and in turn, test the passing of this authorization to the stand alone node app.I've thought about using Express in the local version, but I'm not sure I want to go to that length or if there is a simpler way I can mock the request header to get my local dev going?

Submitted July 26, 2018 at 03:30AM by mgeez

"the overwhelming reason why people pick a programming language is because of its adjoining library. node is popular because of npm and npm is popular because of node. this is why npm has undergone 11,000% growth in the last 4 years." -@seldo at #nodesummit

https://twitter.com/npmjs/status/1022191899304591361

Submitted July 26, 2018 at 12:46AM by Ardougne1

Server cannot parse the same cookies it issues.

Hello, I am running an express app that uses the out the box stack (cookie-parser, connect-session, etc). I am also using a i18n module that sets a cookie depending on the user's language. I am having a cookie issue where I am not sure whether I am sending the correct cookies, or if the server is having problems parsing them. Whenever I authenticate a user, it sends a cookie that looks like this"language=en-US; Path=/, keystone.uid=s%3A5b4f9dc45e23fe02b4b24862%3ACzrzXyYInv7VKl5PaevC9Ynd1qJD72Ip%2BmCd7NynoxU.rGWyRaQecitVOH4vQpZTD1ThpvQ44BI%2BmzOF51kjSms; Max-Age=864; Path=/; Expires=Wed, 25 Jul 2018 19:07:02 GMT; HttpOnly, this.sid=s%3AappByhBNAo31t5RlBF9cd80lZcsQEjE3.o4Wq9o7bhpptCrcJt6XIh1jjKQgWPgibnoI8TDalkDk; Path=/; Expires=Thu, 25 Jul 2019 18:52:38 GMT; HttpOnly"Now inside my app (its a react native app), I store that string verbatim and whenever I try sending it again in the next request, my server cannot parse it, and only parses the language cookie. I've taken that same cookie and tried sending it through fiddler, and postman and it has the same problem. The only way I am able to successfully recall my session is if I only send"this.sid=s%3AappByhBNAo31t5RlBF9cd80lZcsQEjE3.o4Wq9o7bhpptCrcJt6XIh1jjKQgWPgibnoI8TDalkDk;"in the cookie.So upon further testing I decided to download the Cookie parser module to test it individually and it indeed parses the entire cookie wrong. Anyone know whether that cookie string is really invalid to send back to the server? If it is, what can I modify to make it valid? I may have to end up writing a regex to extract the this.sid token and I am not really good with regular expressions so help with that will also be very much appreciated. Thanks

Submitted July 25, 2018 at 10:15PM by apphut

Role and Permission Library Reccomendations?

What are the 'go to' libraries for controlling user roles and permissions in Node?In Laravel I use Spaties permission library.I have come across onury/accesscontrol, but based on the stars it's not as popular as the Laravel one.Any reccomendatioms?

Submitted July 25, 2018 at 09:30PM by Deviso

Parsing and inserting records in the correct order with Tedious and Promises

I have a parsing application that connects to machines via TCP and waits for data to be sent from them. Once data is sent, I have to parse the messages to organize things correctly for the SQL table. Currently, machines may send multi-line messages that each have a four-component payload, or they may send a single-line message with the four-component payload.It is currently imperative to insert records in the correct order for later automation tasks that run against the database. Unfortunately, when a multi-line message comes in and is parsed, the records are frequently inserted in a random order. Is there some queuing function I could introduce to make sure things are inserted serially?A pared down example of my code is as follows:Collecting the data:clients[i].on('data', function(data) { console.log("Data: " + data + " " + hosts[j]); parse_message(data, hosts[j][1], hosts[j][2]); }); Parsing the strings and payload components:function parse_message(data, m_id, type) { //console.log('Message received = ' + data); var msg = data.toString('utf8'); // Convert from object class, split CRs var strings = msg.split('\r\n'); // split multi-line data console.log("Strings: " + strings) strings.forEach(function(element) { var payload = element.split("///"); // split by separator if (payload.length == 4) { // If array is properly formed payload[3] = payload[3].trim(); if (payload[3].includes('N')) { payload[3] = payload[3].slice(1, payload[3].length); } payload[4] = m_id; // Send machine ID payload[5] = dt.getDateTime(); if (type == 'Machine') { Insert_Machine(payload); } else if (type == 'Pallet') { Insert_Pallet(payload); } else { console.log("Type didn't come through. Where am I supposed to put this?") } } }); } Inserting with Tedious and Promises:function Insert_Machine(msg, callback) { var result = []; var deferred = q.defer(); // init promise var connection = new Connection(machine_config); connection.on('connect', function(err) { var request = new Request( // set up request structure 'INSERT INTO dbo.Data_new (pp_id, d_No, d_Note, d_Data, d_seq, d_machine, d_DateTime) OUTPUT INSERTED.Id VALUES (@pp_id, @d_No, @d_Note, @d_Data, 0, @d_machine, @d_DateTime);', function(err, rowCount) { if (err) { console.log(err); // print error on console if anything happens } else { console.log(rowCount + ' rows inserted to Machine_Data: ' + msg); // confirm the insert } deferred.resolve(result); // resolve promise }); request.on('row', function(columns){ result.push(columns); }); request.addParameter('pp_id', TYPES.NVarChar, msg[0]); request.addParameter('d_No', TYPES.NVarChar, msg[1]); request.addParameter('d_Note', TYPES.NVarChar, msg[2]); request.addParameter('d_Data', TYPES.NVarChar, msg[3]); request.addParameter('d_machine', TYPES.NVarChar, msg[4]); request.addParameter('d_DateTime', TYPES.NVarChar, msg[5]); // Execute SQL statement connection.execSql(request); } ); return deferred.promise; }

Submitted July 25, 2018 at 07:35PM by ckindley

Child query for each record in parent query using mssql

I am trying to figure out the most efficient way to do the following using Node.JS and node-mssql. I want an end result that looks like this: { movie_id: '1234', name: 'Hereditary', countries: [ "Canada", "United States", "Australia" ] }, { movie_id: '1235', name: 'Rosemarys Baby', countries: [ "Canada" ] } My tables look like thismovies: movie_id | name --------------------- 1234 | Hereditary 1235 | Rosemarys Baby movie_countries: id | movie_id | country --------------------- 1 | 1234 | Canada 2 | 1234 | United States 3 | 1234 | Australia 4 | 1235 | Canada So far, I've tried several of the different examples from mssql's Github page. I am able to get the results from the "movies" table, but I'm getting stuck when trying to get the countries for each movie.Any ideas as to what the best practices are?

Submitted July 25, 2018 at 07:47PM by TwoNegatives-

What's the fort knox of authentication in Node.js?

Unanimously it seems people are use JSON web tokens, but I'm quite hesitant to use refresh tokens because they are prone to cross scripting attacks. Seems like it isn't meant on something like a finance application. Thoughts?

Submitted July 25, 2018 at 06:18PM by Nephelophyte

How to handle backpressure?

Deploying a Stateful Node.js Application on Google Cloud Kubernetes Engine

https://ift.tt/2JSBL1O

Submitted July 25, 2018 at 03:19PM by hfeeri

What’s a future-proof application? – MESG – Medium

https://ift.tt/2JUphGQ

Submitted July 25, 2018 at 01:29PM by antho1404

NodeJS 10: A Power Packed Features to Look out!

Node.js – an open source platform for fast and scalable network applications. As we all know the impressive introduction of Node.jsIt never lacks updated versions. Using an event-driven and non-blocking model, the platform proves as the super fast to make the lightweight and efficient real-time applications. The broadly used server-side platform is developed on the Javascript V8 engine of Chrome. NodeJS is quite a helping tool for building the most intensive web applications. It can be of live video streaming or maybe SPAs(single page applications)Currently, the Node JS is quite in the discussion of the technocrats because of the power packed features it has. The latest version Nodejs 10.0 is now official and becoming the long-term support in October 2018. Being in the prominent business of serving the latest mobile application development projects and technologies, we would like to share some informative content here regarding the power packed features of the newest NodeJs version. Let’s see the difference this newbie is making with our mobile applications and what’s exciting on the bucket list for the Node.js developers as well as the users.Revamped N-APIN-API bring some of the important changes in execution with the release of NodeJS 10.0 and those are quite impressive. First of all, the N-API is no more in an experimental model. It is officially supported by the API layer. This will help in establishing the stability in the framework as well as the quality contribution to the project development phases. This will give a strong support to the back-end applications. This new update is almost about to reduce the cost of developing native modules and hence automating the system of reusability of codes. N-API’s official version is all set to reduce the intensity while updating so the framework can seamlessly process the deployment. Easier to upgrade and accessible at easy steps. JS ImprovementsThe all-new NodeJS10 is set to bring so many JavaScript language improvements. It includes the prototype.toString() for returning the exact portions of the source code in text and reducing the vulnerabilities for keeping things confidential as much as possible. Performance BoostAlong with the extremely good improvements on bug fixing and error handling in performance, the NodeJS 10 is setting up the standards for boosting the performance through the V8 engine. It includes the async generator and array to keep things ahead. The NodeJS 10 update also increases the visibility in the code to overcome the performance issues. This visibility in the code can be maintained using the trace events. npm V6Node Package Manager is updated from the previous v5.7 to v6.0. Here the Node’s latest update will ship with the update with no more delay but on the prompt basis. This will impact positively on the improvements in all the areas such as performance and stability. Upgrading to the OpenSSL VersionThe latest NodeJS 10 is coupled with the cryptographic support to enable the highly anticipated cipher and authenticators. Ranging from TLS 1.3 to the upcoming LTS in October is a completely supported software platform in terms of meeting standards. 

Submitted July 25, 2018 at 10:39AM by siliconithub123

You Can Now Write Google Cloud Functions with Node.js 8

https://ift.tt/2LQTSGU

Submitted July 25, 2018 at 08:52AM by kiarash-irandoust

5 ways to gain serverless observability - Hacker Noon

https://ift.tt/2LB92Dq

Submitted July 25, 2018 at 07:51AM by nshapira

Tuesday 24 July 2018

To celebrate Node Summit, LinkedIn is offering totally FREE six courses covering Node.js development

https://ift.tt/2uMXbbF

Submitted July 25, 2018 at 12:09AM by jonathanbrizio

Inline C++ code in your Node.js scripts!

https://ift.tt/2LIUY7I

Submitted July 25, 2018 at 12:30AM by vshymanskyy

What is happening here.

Im new to JS and this makes no sense to me how this lineconsole.log(`RunTimeline("${selectedTimeline}", "${selectedTimeline}", 100.0, 50.0, 1, 1, 1)`); returns"", 100.0, 50.0, 1, 1, 1) selectedTimeline would look liketest4

Submitted July 24, 2018 at 09:50PM by holdmyscoobysnack

uws has been deprecated

https://ift.tt/2uOFYid anybody has some background information why the maintainer deprecated uws?

Submitted July 24, 2018 at 08:20PM by xyryvgsxfd

Mutation vs. Object copying server side

So normally I really hate to do mutation of objects because it can be a good way to cause weird errors. However, for a node service which could get getting lots of requests a second, it seems like deeply copying an object to make changes could have performance implications. Any thoughts on this practice server side?Ex:const thing = getThing (); thing.other.deep.prop = 'mutated'; Vs.const thing = getThing (); const newThing = { ...thing, other: { ...thing.other, deep: { ...thing.other.deep, prop: 'not mutated' }, }, };

Submitted July 24, 2018 at 07:13PM by mikejoro

PM2 hangs after update.

Anyone else having problems with PM2 after latest update?https://ift.tt/2LL8M1E a bit at a loss as to how to go about fixing this. Help please.

Submitted July 24, 2018 at 07:33PM by listgrotto

ethereumproject/go-ethereum

https://ift.tt/2uPdi85

Submitted July 24, 2018 at 06:25PM by ICYMI_email

a simple express backend boilerplate with Passport.js-mongoose auth with email activation features.

https://ift.tt/2uM4pN6

Submitted July 24, 2018 at 07:05PM by AlienSoldier

Switching from long polling to sockets? Is this a good idea?

Our application received more users than anticipated. Our lead developer is suggesting we use sockets so we can scale.Is this a good idea? How long do you think this would take to complete?Any advice is helpful

Submitted July 24, 2018 at 04:17PM by ineedhelpcoding

Best NodeJS Frameworks

https://ift.tt/2LludtK

Submitted July 24, 2018 at 02:43PM by Jelvix

Require a class?

I have a class, is it possible to put that class in a file and have require on it on everyfile that I need that class? If so is it just to copypaste the class into a file and just write the path to the file?

Submitted July 24, 2018 at 03:03PM by swessey

Manually make a put request from the browser

Hi, I have a website where logged in users can like posts. If a user is logged in a button with an event listener (that fires an ajax call) attached to it is displayed. If the user isn't logged in a button with nothing is displayed to him. I was just wondering if this solution works. Could a user that isn't logged in somehow send that put request to the server?Thank in advance ;)

Submitted July 24, 2018 at 02:29PM by everek123

Passing a message with Express redirect

Hi. I'm using an Express 4 server and I need to pass a message when redirecting from one route to another. I don't want to use querystrings so I came upon the package express-flash which uses sessions to flash messages between routes which is exactly what I need but it's made for Express 3 and hasn't been updated in over 5 years.Does anyone know of a similar up-to-date package or perhaps a different approach?

Submitted July 24, 2018 at 12:56PM by dr_goodweather

Learn Nodejs by building 12 project

http://sumo.ly/S9qW

Submitted July 24, 2018 at 11:25AM by jbvmt

Coming from flask and python - how do I start with node?

I am fairly experienced with building web applications with flask and python and like the microservices way of doing things. How should I get started with node?

Submitted July 24, 2018 at 11:37AM by yungyahoo

Small app vs large app

Hi, I started learning node 2 months ago and I can build some apps using it. My question basically is what is the main difference between a large app and a small app except for the number of functions. Suppose I have a very simple, one page todo app - the user is able to save and delete todos which are stored in a DB (no user authentication). Then from the other hand i have a large app were users are able to log in, edit their profile, submit posts, comment, like etc. Is there any difference in the way that both apps are written? Does the bigger one require some more advanced concepts?Thanks in advance ;)

Submitted July 24, 2018 at 09:14AM by everek123

Want to start with node...

I already have done some project in node at my university and i want to dig a little deeper now. However I have one question i haven't found answered yet... Can you use node like php, to entirely create dynamic webpages serverside?What i mean, PHP gets interpreted on the server to generate pure html, so you can use loops, conditions etc. to generate your html without the need to alter it on the client side (I'm thinking about stuff like blog entries and so on...)Basically, is it possible to develop a website in node without the need to do "dynamic" stuff with js on the client side?Thanks in advance :)

Submitted July 24, 2018 at 09:16AM by phozphor

http server

I'm not even sure if this is a question for this redit.I'm a complete newbie in computer networks, trying to learn as i go, so i have this little thing that is bothering me :)When i make a simple node.js HTTP server using command "http-server" i can only access that server from my own computer or from my phone for example if its connected to same Wi-Fi, can anyone guide me whats actually happening here, maybe some materials i can read to get a better understanding of HTTP servers and what is required to set one up

Submitted July 24, 2018 at 08:34AM by itjustaspot

Monday 23 July 2018

Node.js, Express.js, Sequelize.js and PostgreSQL RESTful API

https://ift.tt/2mFms3j

Submitted July 24, 2018 at 05:48AM by didinj

Node.js Help: How do I set the pingTimeout in Socket.io

n my Node.js + Socket.io application, I'm trying to set the ping timeout to 63 seconds (63 seconds of inactivity allowed until the connection between the server and the client(s) is considered closed). Unfortunately, when I run my code below, I get the following error:socket.set("pingTimeout", 63000); ^ TypeError: socket.set is not a function Below is my code:var express = require("express"); var socket = require("socket.io"); socket.set("pingTimeout", 63000); var app = express(); var server = app.listen(3000); app.use(express.static("public")); var io = socket(server);

Submitted July 24, 2018 at 03:37AM by ferarri488

restify-decorators: Typescript decorators for creating Restify Controllers

https://ift.tt/2NG7w06 built this ultra-simple package to experiment a bit with typescript decorators and thought it turned out pretty well. I'm using it in production and like that it has eliminated my router files and some boilerplate code.Is anyone else using decorators in production? I'd love to hear some interesting usage ideas.

Submitted July 24, 2018 at 03:54AM by Hudson49423

Permission Issue from C:

I'm attempting to host my node (express) app on a Windows Server (needs to be running on Windows due to a particular package I'm using) from a folder as such "C:\www\myProject". The app runs and everything works except for my file upload/download. I'm getting "EPERM: operation not permitted". My storage location is a network storage device, but Read/Write permission has been given to all users and the server has no issues with connecting to it via File Explorer. I have also made the www folder Read/Write for users (and forced inheritance down).If I move the project to the Users folder, everything works fine. In addition, that app is running via PM2 along with PM2-Windows-Service. Any help is appreciated!

Submitted July 24, 2018 at 12:56AM by JL1988

Calling Javascript Devs: Bounty Available

Hi all, I work for Hydrogen, a fintech startup in NYC. We recently posted a bounty for developing a Passport.js module that implements a 2FA workflow (specifically, the Client Raindrop workflow, a product developed by Hydrogen).The reward is 400,000 HYDRO tokens.Would love to see some of you apply here!

Submitted July 23, 2018 at 11:50PM by HydroNoah

Find All Existing IP Addresses on Local Network with Specific Port

I'm basically using Socket.io to communicate between Express apps on a local network, however I'm having trouble finding a solid method to scan for all available IP/port combos (right now I'm telling my app which IPs to look at manually). Pining all possible IP addresses with node-ping keeps crashing my app, and it seems like there's gotta be a better method for finding all ip addresses on the network that follow the 192.168.1.___:9000 format. I'm new to working with sockets and ports so I'm probably missing something obvious. Thanks!

Submitted July 23, 2018 at 10:33PM by justin2taylor

What is the simplest way to retrieve private files from S3?

I'm building a node/express site using multer-s3 that stores a user's images on Amazon S3. I've got it working, except that the images have to be public for the user to see them. What's the simplest way to implement some security so that users have to be logged in to my site to access their files/see their images?

Submitted July 23, 2018 at 07:40PM by RecursiveBob

excel4node: Node module to create Excel (XLSX) files

https://ift.tt/2uGP2Wy

Submitted July 23, 2018 at 06:41PM by gajus0

One Year of Serverless - a CTO's Review

https://ift.tt/2AaqxG2

Submitted July 23, 2018 at 05:42PM by BlackEagle367

Cluster instance is stucked and cannot be killed.

Hi!I have a windows 2012R2 server. On this server I am running a nodejs cluster. I am using "node-windows" to run it as a service. Until now it was working fine. Nothing cluster related code changed. But now it drives me crazy. When I stop the service from services.msc one of the node.exe process hangs. I cannot kill it with task manager or taskkill /pid 1234 /F.After a couple of minutes it exists, but after that I cannot restart the cluster because I got EADDRINUSE error however there is nothing using the target port. (I have checked it with netstat -a -b -o | findstr "9090".Only solution is full server restart, but it is more the bad..Do you have any idea what to try? Or anybody has a similar issue?node -vv8.9.4Thanks in advance!

Submitted July 23, 2018 at 04:47PM by moqs

Best Practice: Where do I store global objects in Node.js apps?

If I'm building an app in Node.js and I need to use the AWS node module, for example.var AWS = require('aws-sdk');var uuid = require('node-uuid');var s3 = new AWS.S3();If I initialise that object with my user credentials where would I store that object so my other files can access the object?Do I add the object initialisation code to the root index.js file and module.export the object or do I add it into a separate file like s3.js?

Submitted July 23, 2018 at 03:17PM by anthonybudd

Simple NPM module for importing global variables

https://ift.tt/2Lh8qDw

Submitted July 23, 2018 at 01:26PM by mSteckyEfantis

Writing all my code as sync.

Hi, I am kind of new of node (I have been learning it for 1.5 months). What I usually do is write all my code as if it was sync. For example i have a get request in which i have to first retrieve some data from my DB before sending a response. What i would do is:getFromDB().then(function(){ getFromDB().then(function(){ getFromDB().then() //etc. }) }) Basically all of the actions i perform before sending a request are connected by then(). I don't know if this is bad however i think that it might block the code a bit.What are your suggestions?Thanks in advance :)

Submitted July 23, 2018 at 08:09AM by everek123

Sunday 22 July 2018

Retro Tech: What Inside Compaq Contura Aero 4/25 Laptop "4MB of RAM" from 1994

https://youtu.be/m8j73DiyKyI

Submitted July 23, 2018 at 01:45AM by max7451

Config'd : Import your configuration data as a module.

https://ift.tt/2mCs6Dq

Submitted July 23, 2018 at 02:15AM by cheikhseck

Optimize Middleware implementation in Express application

https://ift.tt/2EZo2oH

Submitted July 23, 2018 at 12:32AM by nodexplained

Getting error when trying to install with Node? [MACOS]

Hello!First of all, I'm very new to all this, but was trying to install Nativefier, with the command:npm install nativefier -g When installing Node.JS, I simply used the installer from their website (LTS version).So, when trying to install Nativefier, I get the following error:npm should be run outside of the node replAnd I can't figure out what that means, and how I fix it?So I really hoped someone in here might be able to explain it to me? Maybe even in layman terms?:)

Submitted July 22, 2018 at 10:15PM by LeeSwaggers

Supercharge your debugging experience for Node.js

https://ift.tt/2uEsllC

Submitted July 22, 2018 at 11:02PM by thickoat

Is Node like PHP?

Hello guys,I want to learn node and already bought a video tutorial for it.
But can it really replace the need for PHP? I mean can I get the same results with node
like with PHP?Because I see you have to run Node on a port like 8000. But I just want it to work when I go to my webpage.

Submitted July 22, 2018 at 07:59PM by al00w

Having some javascript experience, Want to make API's for my apps with nodejs

Hi guys i have been working with react native, & i have interacted a lot with API's .I think the time has come now i have decided to learn some backend language to create apis for my own apps. :)I want to go with nodejs because of past familiarity. I may sound stupid but i want to learn node JS just for the sake of making Api's and nothing more. Can you guide me on this , thanks.

Submitted July 22, 2018 at 02:18PM by lovemeslowly

need a Node js project idea to work on...

i just finished a node js course and learned how to apis , Mongodb , express and other stuff(built todo app api).Can someone tell me what should i work on next like a project idea or something to learn that will actually make me a good backend dev. Thanks

Submitted July 22, 2018 at 01:49PM by goldenhunter55

Why is file deletion called "unlink" instead of just delete/remove?

I was searching for how to delete files and came across the "unlink" function. Apparently, this is what is used to delete files. Is this really the correct function? Why the name "unlink"?

Submitted July 22, 2018 at 10:54AM by cemremengu

Automating dependency management updates

With the introduction of package-lock, a new challenge arise - developers have to manually update dependencies and according to what I see - many rarely do that.Seems like the dependency management process should be automated - once a package versioning meets some rules (e.g. a month past since latest release) a PR should be generated with a newer version. I noted few commercial tools that do this, like greenkeeper.ui, but I prefer to stick to a community/free solution for a start. Do you have any solution in mind?

Submitted July 22, 2018 at 09:51AM by yonatannn

code review please?

hello! I started learning node about 3 days ago... I'm working on my first node app... this is what I have so far.... any tips/input/suggestions? thanks...'use strict'; const ejs = require('ejs'); const express = require('express'); const session = require('express-session'); const bodyParser = require('body-parser'); const MongoDBStore = require('connect-mongodb-session')(session); const index = require('./routes/index'); const api = require('./routes/api'); const app = express(); app.set('view engine', 'ejs'); app.use(express.static(__dirname + '/public')); app.use(bodyParser.urlencoded({ extended: false })); var store = new MongoDBStore({ uri: 'mongodb://localhost:27017/securebox', collection: 'sessions' }); store.on('connected', () => store.client ); app.use(session({ secret: 'lot of random chars here my dude', cookie: { maxAge: 365 * 24 * 60 * 60 * 1000 }, resave: false, saveUninitialized: false, store: store })); app.use('/', index); app.use('/api', api); app.listen(3000);

Submitted July 22, 2018 at 09:03AM by superfake123

Saturday 21 July 2018

How to send the JWT back to client after using Passport?

Currently I'm using Passport to authenticate users, which gives me an access and refresh token. How do I send this back to my client so that they can store it in their sessionStorage?I'm following this: https://ift.tt/2uPmAkc

Submitted July 22, 2018 at 03:11AM by Lunoxus

Data control using policies, validation, sanitization etc

I have been working on a project called fission for some time now. Originally I built the library as a part of a very loosely scoped, discovery project for a client and programmed it using PHP. I needed some way of controlling incoming JSON objects and filtering out values which either were not what I expected or were not permitted according the requesting user's roles and scope. I needed this to happen on quite complicated sets of data with fields containing multiple layers of nested and repeated objects. After moving to nodejs a couple of years ago I built this library into my first published NPM library. I found this library to be incredibly useful for the work with microservices I am currently doing and wanted to gather feedback from others.If you work with JSON requests or with formatting the output of NoSQL databases (works for relational DBs as well) and want to filter data based on scope and roles then you might find use for this!https://ift.tt/2Nwe8hA

Submitted July 22, 2018 at 02:20AM by sackrin

Windows Users, Where is your prefix in npm config file

Tool that tells you average endpoint length (express)

Is there a tool/plugin/something that is built to tell you the average time spent creating a response?I'm not sure exactly what to google for so I'm asking here. I'm tempted to just include start/stop/total times in each endpoint's log and then parsing and analyzing that way. Is there an easier way?

Submitted July 22, 2018 at 01:13AM by tenbigtoes

ndb

https://ift.tt/2LB4D0f

Submitted July 22, 2018 at 12:49AM by Permagate

Five ways to serverless observability

https://ift.tt/2JHlKvt

Submitted July 21, 2018 at 05:48PM by nshapira

What are the limitations that I'm going to have if I used knex query builder without using any ORM?

No text found

Submitted July 21, 2018 at 03:43PM by mark_adel

Returns properties names for mongodb collections

https://ift.tt/2LC8biw

Submitted July 21, 2018 at 12:49PM by indatawetrust

What is the most reliable, precise, method to get a user's location?

I'm making a webapp, eventually an app, that relies entirely on a user's location. I've been searching for a way to get a user's location and all that I've found is 3-5yr old information. Not sure if I should retrieve their IP address(which I don't know how to do) and use an ipstack api to get their location or I've seen that you can just do it with simple js to get geolocation. Not sure what's used nowadays and what's scalable, reliable, and precise. Any information would be appreciated, also welcoming any useful tutorial links. Thank you in advance.

Submitted July 21, 2018 at 08:04AM by marincode12

Friday 20 July 2018

[Help] Having issues understanding why my code isn't deleting the data from mongo.

Good evening everyone,I'm working with the MEAN stack. I'm using mongoose. The node/express code goes as follows:app.delete('/api/posts/:id', function(req, res){Post.findByIdAndRemove(req.params.id, function(err, deletedPost){if(err){console.log(err);} else{res.json(deletedPost)}})The angular code is as follows:$scope.deletePost = function(id){$http.delete('/api/posts/' + id).success(function(data){$scope.posts = data;console.log(data);}).error(function(data){console.log('Error: ' + data);})};The html looks like:


Submitted July 21, 2018 at 03:33AM by randygbiv

It's mid 2018, what editor/IDE best supports Node projects nowadays?

The sense I'm getting is it's vscode nowadays; at least it seems the most popular. Is that true?Anyone use Visual Studio 2017 instead? Would anyone say it's better for Node now than vscode?How about JetBrain's WebStorm? Is anyone using it? How do you like it?How good are today's Emacs packages for Node and JavaScript compared to vscode? Last I checked they were far off. Same with Vim.Any insight would be welcome, thanks!

Submitted July 21, 2018 at 12:47AM by Slackwise

Looking for Joi'ful people

Why can't I access nodeJS CLI arguments when my program spawns a child process?

Simplified version of code here:var spawn = require("child_process").spawn; var x = process.argv[2] console.log(x); var process = spawn('python'); The code errors out with "TypeError: Cannot read property 'argv' of undefined". The first and final lines work fine together, and the code will read the argvs fine if the final line is commented out, they just fail to work together.

Submitted July 20, 2018 at 11:24PM by DeadeyeDuncan

node-postgres: safe to use ES6 syntax for query?

Originally, the proper way to use query with parameters is client.query('SELECT * FROM posts WHERE post_id = $1', [id]).Would it be the same (or safe) to use ES6 new quotation syntax?eg.client.query(`SELECT * FROM posts WHERE post_id = ${id}`)

Submitted July 20, 2018 at 09:57PM by eggtart_prince

how should I store a users list of files and folders?

I'm coming from LAMP.. very new to node... can someone just give me a little guidance please? I'm using node, express, and mongodb... I'm trying to create a cloud storage service as a learning lession.. how show I... design/store my data? should I just have a users collection that looks something like this? or is there a better/faster way to do it?{ id: 23452345, email: bob@bob.lcom, password: password, files: { { name: music, folder: root, file: false }, { name: file1.mp3, folder: music, file: true, type: audio }, { name: file2.mp3, folder: root, file: true, type: audio } } } thanks....

Submitted July 20, 2018 at 09:35PM by superfake123

Just learning Node.js, question about using include files for const

Create mocks of your GraphQL schema with few lines of code - Medium

https://ift.tt/2mxkEJH

Submitted July 20, 2018 at 07:26PM by Fewthp

How can I get accurate sin and cos?

I've decided to use decimal.js to take care of precision issue, howevernew Decimal(90).times(dec.acos(-1)).div(180).cos() returns -6.8678308360248557901e-20 Am I doing something wrong here? How can I get it to result in 0?

Submitted July 20, 2018 at 05:55PM by safeTell

Localization

For all you nodejs-programmers out there:I've created another i18n-package for nodejs (https://ift.tt/2LaEg4N... why should I ever do that - there is i18n and i18n-node already...The big advantages are:Automatic language-fallbacks (zh-CN-Hans => zh-CN => zh => invariant language)Automatic fallbacks even work for single keys:You finally don't need to copy-paste whole language-files for similar languagesDifferent file-formats are supported out of the box:JSONJavaScriptYAMLIt's extensible!The module exports all classes which I've created for this packagewhich means you could even create your very own class for an own file-format (ResX, XML, ini etc.)I hope you guys can make use of it!RegardsManu

Submitted July 20, 2018 at 03:39PM by manuth999

node.js equivalent of this command?

Hey, I am thinking of handling webhooks for a telegam bot via node.js. Just curious to see whether it will boost the performance or not. What would be node.js equivalent of /dev/null 2>&1 &" );?>I know nothing about nodejs except the fact that it's asynchronous. I followed basic tutorials and could create a basic hello world on my nginx server. Any help will be appreciated. Thanks for reading!

Submitted July 20, 2018 at 04:03PM by edgycorner

Is this a virus? If so... npm module must be compromised.

https://ift.tt/2LAg9J6

Submitted July 20, 2018 at 04:16PM by akujinhikari

BreezyPDFLite node Client, generate beautiful PDFs from HTML w/Chrome

https://ift.tt/2Nt99ya

Submitted July 20, 2018 at 03:24PM by deedubaya

Ralphi - Simple rate limiting server in pure nodejs

I released a node rate limiting module.https://ift.tt/2O0jAdE runs purely in nodejs so no need for any other dependency (Like memcached or redis).The focus is around preventing bruteforce attacks. And it is intended to be used in small to medium projects where adding another database to your stack doesn't make a lot of sense.Any feedback would be appreciated

Submitted July 20, 2018 at 03:29PM by yonjah

What's data/database migration?

Can anyone explain what data/database migrations are? And how do we do it with node? As far a I know, it is the process of transferring your data from one database to another. But how is it done practically? And why is it important?

Submitted July 20, 2018 at 01:44PM by rizwanahmed19

ekst – Append, prepend, replace or remove basename extensions

https://ift.tt/2uRIHqj

Submitted July 20, 2018 at 10:25AM by dpswt

N-API: Next generation APIs for Node.js native addons available across all LTS release lines

https://ift.tt/2uQEnaJ

Submitted July 20, 2018 at 10:21AM by hfeeri

Run cli commands in child process using Node js?

No text found

Submitted July 20, 2018 at 11:49AM by SilverExit

npm enables two-factor authentication protection for packages

https://ift.tt/2Jm2PpD

Submitted July 20, 2018 at 10:34AM by hfeeri

I want to run an executable script from node app, the executable script is a command to run cli of an application. When i use child_process for the same , the output appears to be nothing.

It seems like the process is running but somewhere in the background , I am not sure, Can anybody help?

Submitted July 20, 2018 at 08:29AM by SilverExit

Thursday 19 July 2018

Local network game lobby

I am building an Electron-based game that uses Socket.io for local multiplayer (not connecting to an Internet-based server). I am having trouble setting up the client connection to the host. Because the socket.io server is local, not on the internet, I can't predict the IP address for it. From thinking about it, I have two options:Tell the host their IP address, then provide it to the client.Have the client scan the local network for the game being hosted.I'm not quite sure how to do either of these, and I'm honestly not picky. I looked very briefly at the node docs for os, but I didn't see a reliable way to get the correct network IP address. I also saw a way somewhere to scan a network for open ports, but I'm not sure if my game will be the only thing using that port or not, so I'm not sure if I should set up some kind of response to ping against that won't trigger socket.io.I realize this is kind of a niche case, but does anyone have a good place to start on either of these methods? I'm really not picky, I just want to get this going so I can start testing the host/client interaction. Thank you in advance!

Submitted July 20, 2018 at 06:06AM by yagaboosh

What is the difference between all the GraphQL Server libraries in NodeJS?

Hi I am a relatively new NodeJS developer and I want to learn GraphQL. As the title says, I am a bit confused with all the NodeJS packages for GraphQL, there are literally so many to choose from and searching online I got more and more confused as to which are native libraries, which are different flavors, which are helper libraries, etc.What is the difference between grapqhql, graphql-tools, apollo-server-express, apollo-server-core, graphql-middleware, graphql-yoga...Essentially I have a microservice which communicates with 3 other services and a datastore to stitch information together and serve it out. I wanted the flexibility for clients to cherry pick the exact response they want. Right now I am using express as my primary framework, but I didn't want to learn graphql just for express. I wanted to use this project to understand how to implement graphql in general across different frameworks.Any help, criticism, advice would be appreciated. Thanks guys

Submitted July 20, 2018 at 05:51AM by marauderpadfoot

How do I add a username/password login form for a SPA using Oauth2?

(Question status) awaiting for repliesI've done a lot of research, and most articles say that it is best to use Implicit Grant for Spas, such as React and Vuejs (my frontend is built using Vue).However, I want the user to have the ability to enter email or username and a password to login (which is the account they created via whatever the sign up link is for my webapp).Because the articles state that SPA cannot hold secrets securely, that means I'm only left with Implicit. Any suggestions? I want it to have username and password login (in addition to optional social SSO login).Thanks!

Submitted July 20, 2018 at 04:55AM by ewliang

Javascript and HTML vs Templated engines such as Handlebars

I'm deploying a sinple login page using express. What are the benefits to using Handlebars couldn't the same thing be accomplished with Javascript and HTML using document.getElementById() rather than using in handlebars. what are the overall benefits to using Templated engines, specifically Handlebars with Express

Submitted July 20, 2018 at 04:06AM by nasty_nas03

Quick help with timeout plssss

function f ( ) { console.log('starting loop') for ( let i = 0; i < 1000; i++) { for ( let j = 0; j < 100000; j++) {} } done(); } function done() { console.log('done..'); } function fail() { console.log('Function call taking more than 2 seconds') } // function call f(); // setting timeout for failure... should break out of f() setTimeout(fail, 500); In repl this prints out :Starting loop done.. => 1002 // no clue why this is here Function call taking more than 2 seconds So I am trying to learn how to use setTimeout and I wrote this example code. Here I am looping 1000x100000 times (apprx. 10 seconds) and I want to create a timeout such that if the function f() is taking more than 2 seconds, than I call the fail() method to indicate that f() 'timed out'. How can do i that?Thanks for the help!

Submitted July 19, 2018 at 08:56PM by laugh3x

AWS loading issue?

We are currently using a MEAN stack. In the test environment, it ran fast. But after we launched, users are having trouble logging in and load times are super long even with a few users.Is this normal? What can I do with AWS to fix the issue?Any advice would help.

Submitted July 19, 2018 at 07:42PM by ineedhelpcoding

Malicious Modules — what you need to know when installing npm packages

https://ift.tt/2uOvheR

Submitted July 19, 2018 at 06:19PM by lirantal

change my mind

https://ift.tt/2mt8cKI

Submitted July 19, 2018 at 06:25PM by FireController1847

A Simple, flexible, full-stack project scaffolding based on React and Hapi

FengShangWuQi/Polygonal

Submitted July 19, 2018 at 04:16PM by fengshangwuqi

Need help serving up sites from a website builder!

We are using react.js, node.js, and postgreSQL.I am currently in a web development bootcamp, and we are working on our final group projects. My group is working on a simpler clone of launchaco.com and working on building reusable components to build custom websites has been going great. The problem we are having is how to automate the process of serving up websites either on a sub-domain of our domain, or allowing the user to purchase a domain through the google domain api, and then serve up their website, using surge or some other tech. Has anyone done this/seen it done? Or can anyone push us to a resource that will help us learn how to do this?Your help is very much appreciated!

Submitted July 19, 2018 at 05:41PM by MichaelRT17

Katalon Studios - anyone use this?

Hi, I'm researching a testing framework to create a E2E test suite for a emberJS front end. Anyone use Katalon?Cheers,Huck

Submitted July 19, 2018 at 04:28PM by HuckleberryC

Create your own webpush server in nodejs + client example

https://ift.tt/2mvzhNy

Submitted July 19, 2018 at 12:59PM by freecodeio

Cluster module isn't working

I don't know if i just messed something up or if the module is actually broken.I'm using Node version 8.11.3. I'm following a tutorial and i literally copied over the same code. Yet the results are different.Here's the code:const cluster = require('cluster'); // Check that the current instance is Master if (cluster.isMaster) { // Cluster Manager / Master cluster.fork(); cluster.fork(); cluster.fork(); cluster.fork(); } else { // Child / Worker const express = require('express'); const app = express(); function doWork(duration) { const start = Date.now(); while(Date.now() - start < duration) { } } app.get("/", (req, res) => { doWork(5000); res.send("This was slow"); }); app.get("/fast", (req, res) => { res.send("This was fast"); }); const port = 3000; app.listen(port, () => { console.log((`Server started on port ${port}`)); }); }When i test in browser, i fire up the root route and then the "fast" route. The fast route should load instantly because of clustering, and after 5 seconds the root route should load. But it doesn't happen. Both routes load simultaneously after 5 seconds. I'm at a loss.

Submitted July 19, 2018 at 01:42PM by Pelopida92

Nock Is A Smell, But It Can Be Useful As Long As You Use It Correctly

https://ift.tt/2uJ65q1

Submitted July 19, 2018 at 10:39AM by fagnerbrack

Sending and Receiving Emails Using Node.js

https://ift.tt/2mr8ulj

Submitted July 19, 2018 at 09:16AM by Zeolearn

6 Awesome Things You Can Do With NodeJS

https://ift.tt/2uMZ5IN

Submitted July 19, 2018 at 09:49AM by Zeolearn

Wednesday 18 July 2018

Stopwatch for high-resolution timing

https://ift.tt/2mulve8

Submitted July 19, 2018 at 02:15AM by Superseuss

The course is really great. I liked that everything was shown from the beginning to the end, with many exercises on the way. Also, one of the advantages is that during the course we develop several complete applications that are a good base for future improvements.

https://ift.tt/2J4c1iu

Submitted July 18, 2018 at 11:30PM by angela7walker

Node v10.7.0 (Current)

https://ift.tt/2zQdMk2

Submitted July 18, 2018 at 09:35PM by dwaxe

Safest ways for creating user Registration and Login systems?

I have been researching on Google and Youtube for about a week and all I get is people making tutorials using pre written boiler plate codes and insecure authentication practices.I am planning to make a commercial web app and my biggest concern is security, I am new to NoseJS and I would appreciate it if you guide me or show me a place to start.Are there actually any books written about user registration and authentication systems in NodeJS.

Submitted July 18, 2018 at 08:23PM by RawaZz95

Beginner's Question About NPM

I've been using NPM (well using as in copy-pasting commands to install packages), and I'm actually trying to learn how to properly use it now.I noticed that even when I installed packages locally, they weren't appearing in my project directory (i.e - no node_modules folder was being created in the local directory). As such, I did some investigating and I saw I had a node_modules directory underneathC:\Users\myusernameI also saw a .babel.json and package-lock.json file in that same directory.I looked inside, and saw all packages that I had installed "locally" were actually appearing there.Is that normal, or is my npm installation messed up? I feel like it's incorrect - since it's probably the reason why when I install a package locally, no node_modules directory is created in the local project folder, but I'm not sure.

Submitted July 18, 2018 at 06:10PM by throwaway119284

Here's how to get started with the GridDB Node.js Client!

https://twitter.com/GridDBCommunity/status/1019289084429127681

Submitted July 18, 2018 at 06:11PM by IllegalThoughts

New Linux user on Debian 9 - Does it matter what directory I'm in when installing nodejs and npm globally?

I'm running crostini on pixelbook and trying to install nodejs and npm. Yesterday I did it (I believe) in my root home folder and later had trouble installing create-react-app because I didn't have permission as a root user or something. I've since deleted and reinstalled crostini and am going to try again. Anything I should know about where and how to safely install nodejs and npm safely as a beginner?

Submitted July 18, 2018 at 04:13PM by BrakeGliffin

How to get value from a promise used from a module?

Hii!I'm having a problem.I've used Axios to get a data from an external API, Axios basically uses a promise to make a request to other website, then handle the data.It goes in this fashionaxios.get(API_URL) .then((data)=>{code}) .catch((error)=>{more code}) If I want to console.log the received data, from INSIDE the "then" in the axios promise, it shows me the right data fetched from the api.but If I do:let request = ('./request.js') //the code with the axios request would go here let data = request.get(API_url) console.log(data);what I get is "[object promise]" not the data.wrapping the call in async/await is not working, it gives me the same results: [object Promise].What do? (yes, I've already looked in stackOverflow haha)Thanks!

Submitted July 18, 2018 at 04:19PM by NodeNoodle

cloud-bench - CLI to benchmark cloud servers (with results from several top providers)

https://ift.tt/2L79REu

Submitted July 18, 2018 at 04:07PM by GoldFire33

Standard Library / Code.xyz add API Permissions (user / IPv4) to their Node.js API Platform

https://ift.tt/2JvkYSd

Submitted July 18, 2018 at 05:05PM by keithwhor

Help with Async and wait

I am trying to create a bot with pupeteerjs that will receive information from a form and will use it to populate another form in a wevsite.Currently I am using node's async function and inside my 'async" function I have been repeating a lot the use of the "wait" methid, I would like to know if anyone could recommend me some resources(patterns, codes etc...) that could help me learn how to make my code more "DRY" (use the wait method less times) when I refactor it

Submitted July 18, 2018 at 01:12PM by Squexis

How would you attack a node.js application?

As part of a blog post that I'm writing on Node security, I'm trying to think how would an attacker knowing that the application is created with Node trying to exploit the system ("If you can’t think like an attacker, you can’t think like a defender...")?I'm focused only on the node characteristics that might help the attacker, not generic web application weakness like try DDOS, try inject SQL, etcFor example, some idea - many Node developers let the process exit on error, so I'll try to provide many faulty JSON inputs with hope that one will trigger process exit. Once I find the right input, I can very easily generate a DOS conditionOther ideas?p.s. I'm not an attacker, if you want to see a draft of the blog post - just ask

Submitted July 18, 2018 at 12:17PM by yonatannn

HystrixJS TypeScript Decorator

https://ift.tt/2JzdMEz

Submitted July 18, 2018 at 11:38AM by dudousxd

Tuesday 17 July 2018

How can I make a scheduled request in Node for JSON?

New to Node but not programming as a whole. I am attempting to create a scheduled request for a JSON API in node that happens every 15 minutes in an AWS Lambda. I want the request to get JSON from an API. I am very confused on how to write this in node and some pointers would be really great. (I want to store that JSON in AWS Lambda to where I can request from my iOS app). Can anyone point me in the right direction. (If anyone has experience with this and AWS Lambda some pointers there would be good as well.Thanks.

Submitted July 18, 2018 at 04:45AM by negnatz

What should be included in a response ?

Hi, I've been learning NodeJS for some time and recently started a side project. So far. I just make responses like res.send('success') and that's all. With this project I'd like to follow best practices and learn them. So, what should be included in response message ? What are the headers should be included ?

Submitted July 18, 2018 at 03:27AM by sp3co92

Using Environment Variables with Google Cloud Functions

https://ift.tt/2Nop2pH

Submitted July 17, 2018 at 10:24PM by kiarash-irandoust

Getting Started with Async Iterators in Node.js

https://ift.tt/2JwYLmz

Submitted July 17, 2018 at 07:56PM by code_barbarian

Simple in use (based on EventEmitter) crawler of site web pages by domain name

https://ift.tt/2uK2uYC

Submitted July 17, 2018 at 07:34PM by safonovpro

Opinions on Claudia JS

I have seen this in a couple JS shops while browsing jobs. Has anyone used this in a production app? How does it compare to serverless? Does it's abstraction take away any major features of Lambda? Just curious on everyone's thoughts.

Submitted July 17, 2018 at 06:45PM by maxwellsmart84

API Server wrapper on top Expressjs using mongoose & sequelizejs

HiI've created API wrapper on top of Expressjs for CRUD API using mongoose & sequelizejs.It has following featureAutomatic CRUD API creation according to Database ModelsSupport of mongodb & relational database using sequelizejsMinimal Code changes for adding new routes & handlerSeparation of routes,models & controllersPredefined CRUD methods to get data from datbaseHere is npm libraryhttps://https://ift.tt/2L1NQHs for your feedback..

Submitted July 17, 2018 at 06:05PM by sunilmore690

Transform stream which batches a bunch of input data into groups of specified size

https://ift.tt/2L3XLMv

Submitted July 17, 2018 at 05:28PM by roccomusolino

Simple, Cross-Platform calculator built with Electron

https://ift.tt/2D5P4ss

Submitted July 17, 2018 at 04:08PM by xxczaki

Node.js Open Source of the Month (v.July 2018)

https://ift.tt/2L3hBYo

Submitted July 17, 2018 at 04:06PM by Rajnishro

Building RESTful Web APIs with Node.js, Express, MongoDB and TypeScript — Part 3 - Medium

https://ift.tt/2FIHNQj

Submitted July 17, 2018 at 02:20PM by Fewthp

Login issue in nodejs application

https://ift.tt/2mptpp8

Submitted July 17, 2018 at 10:42AM by krab7

FIFA 2018 World Cup Live Map Using Twitter and Scaledrone

https://ift.tt/2zKKoLR

Submitted July 17, 2018 at 10:46AM by zomgitsrinzler

Handling concurrent HTTP connections in Node.js

https://ift.tt/2Lcj8KZ

Submitted July 17, 2018 at 09:04AM by tpiros

A Quick SSL Certificate Installation Process for Node.js

https://ift.tt/2zMeoqL

Submitted July 17, 2018 at 09:05AM by sslsecurity

React and Node app help.

I am making a web site and choosing React and node as the stack. I have worked on both separately but now I want to use both of them together. I want to make api's with node and consume them with react. And also I have never used react on production (i.e. never used npm run build or whatever that command is). I can't figure out how routing will be done. Will react router handle that for me or I should specify routes in index.js?P.S. It's mostly a static site with not much back-end intensive stuff so routing is my main concern.

Submitted July 17, 2018 at 09:47AM by swardhan

Monday 16 July 2018

Wanting project ideas

Hey!So I've been developing using Node for well over 3 years and have learned quite a bit in regards to the large portion of web servers (Express, Fastify), ORM's (Bookshelf, Objection) and other libraries. But I hit a slope and am needing some ideas on projects to develop (open source).Web development is my favorite! So anything using API-based services and Vue or Angular sounds ideal.

Submitted July 17, 2018 at 03:58AM by ChrisCodes

Creating Node Addons with C++ and Bazel

https://ift.tt/2zUhkBZ

Submitted July 17, 2018 at 03:13AM by funJS

Best Practices For Storing User API Keys With Node/Mongo?

I have a Node app which uses MongoDB. Inside my database, I'm going to be storing API keys provided by the user.Obviously, this is sensitive data so I don't want to store them in plain text within my database. Are there any best practices for storing private user data?Currently my project is using PassportJS for logging in and out and that's working great. I wonder if there's someway to leverage that for storing these API keys?Any tips or guides would be really appreciated. Thanks!

Submitted July 16, 2018 at 10:42PM by phil917

First day at job.

Sorry for my bad English. It was my day at job as Software developer. I'm told to build a dashboard to show analytics of an existing software. The stack is React, Node, MySQL. Now I've worked quite a bit with React and know enough Node to build a basic CRUD application with MongoDB and mongoose. But they want me to use MySQL and knex.js.I hadn't heard of knex.js until today. They want me to follow the structure of an existing project that they've built using the same technologies. And they admit that they have not followed best practices and there are many workarounds to things they couldn't find an optimal solution for.Now, how should I start learning knex with node and mysql and get up and running with best practices that are followed in the market. Can you please point me to the right direction?

Submitted July 16, 2018 at 10:07PM by rizwanahmed19

Automating with Node.js - Lesson 1 - Feedback on my narration please? (first time)

https://www.youtube.com/watch?v=V-RbmMd4iRA&t=99s

Submitted July 16, 2018 at 07:44PM by SMKS

Node.js career question

Hey Guys, I have been a backend developer for about 7 years now at mostly large companies. Java has been the primary language I've used along with doing a bit of full stack.I've been doing a lot of node lately for side projects (for work and at home) and I enjoy it so much more than generic Java programming.How many of you have transitioned into a NodeJs role after already having a good paying career in another technology? I'm looking around at jobs and I'm about 90% certain that I would have to take a pay cut to get into node more.

Submitted July 16, 2018 at 03:11PM by randomFIREAcct

IoT Project - This is how I watched FIFA final with Arduino..

https://youtu.be/0_OIhudhWEE

Submitted July 16, 2018 at 03:13PM by teammevk

dana: Simple CLI app for making database schema migration easier

https://ift.tt/2IE6zU1

Submitted July 16, 2018 at 01:59PM by cognetio

Hosting multiple apps on the same server — Implement a reverse proxy with Node - Medium

https://ift.tt/2w8Fwyy

Submitted July 16, 2018 at 01:09PM by Fewthp

How To Deploy NodeJS App to Heroku

https://ift.tt/2zHLOad

Submitted July 16, 2018 at 01:31PM by AgiraTechnologies

pm2 cluster mode with express EADDRINUSE

I'm trying to run a node app using pm2. The app by default runs on port 2345, I've changed the config to so it runs in cluster mode and 'instances' is set to max which at the moment only launches 2 instances. As soon as I start the app and both instances of the app launch, one keeps restarting until it does so 15 times at which point it errors out. Looking at the log it complains that"Error: listen EADDRINUSE :::2345"How can I run the app in cluster mode w/o it crashing? Everything I found online points to running the app on a single port and the cluster manages everything. I'd rather have this scale up/down depending on the server resources rather than having to manually edit the config and run X number of apps in fork mode all on different ports.

Submitted July 16, 2018 at 12:34PM by cinek2

JavaScript Engines: The Good Parts

https://www.youtube.com/watch?v=5nmpokoRaZI

Submitted July 16, 2018 at 10:03AM by fagnerbrack

An npm package that prints todos to the terminal

https://ift.tt/2NQEpIp

Submitted July 16, 2018 at 09:35AM by JakeGore

Sunday 15 July 2018

Issues installing live-server

No matter what I do, I can't seem to get live-server to install properly.I've tried npm -i live-server, yarn global add live-server, and npm install -g live-server.All to no avail.I get this, or some manner of this everytime:"npm WARN optional dep failed, continuing fsevents@1.2.4"Please help!

Submitted July 16, 2018 at 04:37AM by FurFaceMcBeard

Express error - cannot find module

Hi,I'm trying to get into node.js and Express, and have been following a book (Getting MEAN With Mongo, Express, Angular, and Node). I've got through to halfway through chapter 4, but when I swapped from the single default controller to the two new ones instructed by the book, I've started getting the following error every time I try and run it:PS C:\Users\james\node\loc8r> node . module.js:549 throw err; ^ Error: Cannot find module 'C:\Users\james\node\loc8r' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3 The files I've modified are:/loc8r/app_server/routes/index.jsvar express = require('express'); var router = express.Router(); var controllerLocations = require('../controllers/locations'); var controllerOthers = require('../controllers/others'); /* Locations category controller */ router.get('/', controllerLocations.homelist); router.get('/locations', controllerLocations.locationInfo); router.get('/locations/review/new', controllerLocations.addNew); /* Others category controller */ router.get('/about', controllerOthers.about); module.exports = router; /loc8r/app_server/controllers/locations.js/* GET homepage */ module.exports.homelist = function(req, res) { res.render('index', {title: 'Home'}); }; /* GET Location info */ module.exports.locationInfo = function(req, res) { res.render('index', {title: 'Location info'}); }; /* GET add review page */ module.exports.addNew = function(req, res) { res.render('index', {title: 'Add a review'}); }; /loc8r/app_server/controllers/others.js/* GET about page */ module.exports.about = function(req, res) { res.render('index', {'title': 'About Loc8r'}); }; I'm aware that this folder structure isn't how things are done by default but it's the way the book recommends it be done for neatness. It worked fine with the default route and with the default route split into a route and a controller, but not since. I'm sure it's an obvious mistake but I've searched and can't find any answer. VS Code doesn't highlight any formatting errors so I've given up hope it's something glaring for me to fix like that.Node is v8.11.3, NPM is v5.6.0, Express is v 4.6.13 according to npm listCould someone also advise how I'd go about following back through the error message to work out where I've gone wrong?Many thanks,James

Submitted July 16, 2018 at 12:13AM by jamesm_14

What is the standard way to store runtime settings?

I currently develop an app that consists of 3 separate packages for now and they all share the same database (it's MySQL).Now I want to give user an ability to toggle some features on/off using some interface (I believe it doesn't matter, it could be web page with form, REST endpoint, etc) so my app should be able to save this setting somewhere and retrieve it when needed.What is the best way to do this?The most obvious way for me was using of JSON file but I don't think that it's a right way because my app may have hundreds of settings and I think that I should use database for this because it's application data after all.I came with idea to use settings table where I have text key and JSON value. JSON because MySQL supports it natively and settings may have different type of values. Then I can have some wrapper class that will fetch all settings from database and reload them when something changes (so I don't have to do DB requests when I need to check some setting).Is it OK?

Submitted July 15, 2018 at 11:03PM by Max_Stern

Am I webpacking my modules incorrectly?

I've been trying to publish modules, and I've even followed some tutorials on how to do it. They publish fine and run fine as ES6 in dev mode, and even when I publish them Webpack'd as ES5, they work fine in dev mode. But when I do a production build of a create-react-app, I get an error:Failed to compile. Failed to minify the code from this file: ./node_modules/MY_MODULE/index.min.js:1:1198 Read more here: http://bit.ly/2tRViJ9 error Command failed with exit code 1. This happens for all of my modules, no matter how simple or complicated they are.Here's my webpack file for the module in question:const path = require('path'); module.exports = { entry: './index.js', mode: 'production', module: { rules: [ { test: /\.js$/, use: { loader: 'babel-loader' } } ] }, output: { filename: 'index.min.js', library: 'MY_MODULE', libraryTarget: 'umd', path: path.resolve(__dirname, '.'), umdNamedDefine: true } }; Here's my minified output, in case anything is glaringly obvious to anyone:!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("react-object-prop",[],t):"object"==typeof exports?exports["react-object-prop"]=t():e["react-object-prop"]=t()}(window,function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){const r=()=>{let e=Object.create(null);return t=>{let r=!1;const o=Object.create(null);for(const[n,u]of Object.entries(t))Object.prototype.hasOwnProperty.call(e,n)&&e[n]===u||(r=!0),o[n]=u;return r&&(e=o),e}};r.default=r,e.exports=r}])}); I've run out of ideas. All help is greatly appreciated.If direct links help, a simple module is react-object-prop and a complex module is react-portfolio. Both give "failed to minify" errors for create-react-app build. Am I just building it incorrectly with libraryTarget: 'umd'? I

Submitted July 15, 2018 at 07:32PM by GAMEchief