Sunday, 31 December 2017

How to write your own custom middleware in Express application?

http://ift.tt/2EqEuOa

Submitted January 01, 2018 at 02:16AM by nodexplained

How to write custom route specific middleware in Express application?

http://ift.tt/2EsrbNl

Submitted January 01, 2018 at 02:17AM by nodexplained

How to appropriately query a has many relationship with knexjs ?

I've used sequelize before and they have a include property where you can add associations to different models. See here for an example of how I used it The return data type would be something like this:(FYI, I am using MySQL)Say there is a table called boards & threads.The relation I have is that "boards has many threads". So I want the response to look like this:{ boardName: "pol", threads: [{subject: "...", author: "", ...etc}]} Where the threads array is given to me because of the "included" model I specified.How can this be achieved in knexjs? What query must I build? I tried using the join() method but that merged everything together as expected. I came up with this solution but I feel as though I can take advantage of knexjs query methods to create my association array like sequelize does.TL;DR - How can I use knexjs to return an array of values based on a has many relation for tables?

Submitted January 01, 2018 at 12:36AM by HappyZombies

Question: How to structure multiple apps (with diff dependencies) in one single codebase?

In an ideal world, I'd split them up into multiple codebases but I'd like to have it on one single VPS (Digital Ocean droplet) so I can run multiple Node instances from one cheap server because I'm just experimenting with NodeJS for now. I'd like to stick to best practices within reason.Requirements:Single codebase so I can just boot up multiple Node scripts in same server.Currently, it will support a portfolio site/serving web requests ("client" module) and a blog running on Ghost ("blog" module).In future, I plan to put random REST API endpoints for random web apps/native apps on there (probably all into an "api" module, with possibility of breaking up large APIs into their own modules).Questions:Should I have multiple package.json and/or node_module dir? Or Keep it all in one and just pull what's needed in into the individual modules?How should structure my directories? Spent the last two hours reading about NodeJS architecture/project structure and came up with something like this:config/ blog.config.js client.config.js *.config.js blog/ (blog app code here) client/ (portfolio site and web frontend code here) api/ ... Am I missing common concepts/terms? Example, I saw mentions of "workers" in a RisingStack blog post. Is that what I'm creating within the "api" module to handle random API calls? Am I trying to setup a monorepo?I don't foresee much traffic but what are some important and not-so-important-but-good-to-know performance considerations?Are there other important things I'm not considering?

Submitted December 31, 2017 at 11:39PM by Xchai

How to Setup ESLint with Standard

Hi everyone, new to Node/JavaScript so please correct me if on anything I may be doing wrong.How do I setup ESLint w/ Standard? I've got a "lint" command in my script section of package.json like below:"scripts": { "dev": "./node_modules/.bin/eslint . && nodemon server.js", "dev:db": "json-server --watch db.json", "test": "echo \"Error: no test specified\" && exit 1", "lint": "./node_modules/.bin/eslint .", "lint:fix": "eslint --ext .js -f ./node_modules/eslint-friendly-formatter --fix server" } "dependencies": { "axios": "^0.17.1", "babel-eslint": "^8.1.2", "eslint-plugin-html": "^4.0.1", "express": "^4.16.2", "express-graphql": "^0.6.11", "graphql": "^0.12.3", "json-server": "^0.12.1", "nodemon": "^1.14.6" }, "devDependencies": { "eslint": "^4.14.0", "eslint-config-standard": "^11.0.0-beta.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-node": "^5.2.1", "eslint-plugin-promise": "^3.6.0", "eslint-plugin-standard": "^3.0.1", "standard": "^10.0.3" } But when I run yarn dev all I get is some of the ESLint outputs. When I violate the Standard linting guidelines no error is returned.My expected result is that every time nodemon restarts all linting errors will be outputted and nodemon will refuse to execute until the linting issues are resolved.As it is now only ESLint issues will stop my server from running. Thank you for any tips or references.

Submitted December 31, 2017 at 11:20PM by AmishPanda00

JavaScript Has Already Won

http://ift.tt/2CxQs8s

Submitted December 31, 2017 at 09:06PM by jonnyasmar

I built a simple API with Node/Express, what is the most straight forward way to add SSL?

I created a remote API service for a single GET and POST route. The site that uses the GET is on SSL and requires the SSL from my endpoint in order to work. I have never gone through this before and every tutorial I've seen mentions nginx, apache, etc. I am running just Node 6.x with Express where I created a very simple app for the GET/POST methods.What are my options here?

Submitted December 31, 2017 at 06:11PM by evsoul

LISK blockchain platform sets it's sights on JavaScript and Node devs

http://ift.tt/2Ek9rnx

Submitted December 31, 2017 at 07:31AM by xxchoicexx

Requestix: a web app for requesting files from clients. Built with node, express and mongo. Feedback appreciated!

https://requestix.com/

Submitted December 31, 2017 at 07:26AM by rubblebath

Saturday, 30 December 2017

How do I wait for the results of a function to later use?

Im a bit of a noob it javascript and node, so sorry for the simple question.I have a varable I need to use but its value comes from a function that i getting data via an API. var myVar = getVarValue(); console.log('This doesnt print myVar' + myVar); function getVarValue (){ myvarout = getapi stuff(); console.log('This prints myVar' + myvarout); return myvarout; } So i need getVarValue to finish. How do I get the result of the function after getVarValue is done?

Submitted December 31, 2017 at 04:43AM by wobmonsta

Is there any way to use Socket.IO and AWS IoT Shadows togheter?

I'm getting a response from my AWS IoT thing. Is there any way to send this response to Socket so I can display real time information from my IoT?Thank you guys!

Submitted December 31, 2017 at 02:20AM by BbBebop

Twitter status: Introducing gar, the lightweight Node argument parsing library

https://twitter.com/ethanent/status/947261129041915904

Submitted December 31, 2017 at 12:21AM by Etha_n

gar - the lightweight Node arguments parser

http://ift.tt/2zRmMjB

Submitted December 31, 2017 at 12:01AM by Etha_n

How do I get my index file to recognize an included javascript file

So im running through demos and I think i missed something. In my index file I had the line And it works just fine. Now im trying to move the javascript to a file that I will include using the line Then in the main.js window.alert("sometext"); But for some reason Im not getting the pop up. What did i miss?

Submitted December 30, 2017 at 11:03PM by wobmonsta

Introducing Mongoose 5.0.0-rc0

http://ift.tt/2lmKiAA

Submitted December 30, 2017 at 07:53PM by code_barbarian

The Node.js Community was amazing in 2017! Here's the proof:

http://ift.tt/2C027vB

Submitted December 30, 2017 at 06:02PM by hfeeri

Write GraphQL node.js backends with easy to understand, declarative syntax using NestJS framework

http://ift.tt/2zP5pzX

Submitted December 30, 2017 at 04:44PM by mysliwik

Apollo GraphQL & NestJS integration is FINALLY here! Create well-structured node.js server-side applications with GraphQL and Nest framework

http://ift.tt/2zP5pzX

Submitted December 30, 2017 at 02:12PM by mysliwik

Do you guys are interested on a playing cards trade platform? You are welcome! Needed help to develop the open source and free platform. Also you could learn some Node.js concepts!

http://ift.tt/2CbH90Z

Submitted December 30, 2017 at 11:10AM by jesusgn90

How do you get a .dev/.local domain for an express app?

Like an apache VirtualHost. Bit tedious working with port numbers.

Submitted December 30, 2017 at 10:57AM by Saltones

Friday, 29 December 2017

NPM package with . or -

http://ift.tt/2CkUVgN

Submitted December 30, 2017 at 05:28AM by Bigkefjee

How to create groups of google hangouts in nodejs?

hello some programmer has some idea I want to do the function of creating groups of google hangouts in nodejs or reactjs.I've seen the groups work in real time in a web application called free4talk.If someone is interested in helping me, let me know.thanks.

Submitted December 30, 2017 at 03:20AM by siwars

Introducing Hyperapp 1.0 — 1 KB JavaScript library for building frontend applications.

http://ift.tt/2BOe9b7

Submitted December 30, 2017 at 02:48AM by JorgeBucaran

Proper structure using ejs

Hey just a quick question on structuring my app. basically, I have a partials folder that holds stuff I expect to see on most the pages in my app e.g. navbar.ejs, the navbar expects a user object to be passed through with the router request; if it's true or false the navbar.ejs has an if clause and reacts accordingly. Is this a good solution ? It seems clunky. If not do you have a example I could see

Submitted December 30, 2017 at 02:25AM by rvncpn

I've moved my personal dashboard app to Electron, and I'd love some feedback!

http://ift.tt/2BbyCKW

Submitted December 30, 2017 at 12:55AM by johnjones4

Node cluster examples other than for handling server load?

Hey there /r/node, here is the context of my problem:I'm creating a game with electron and I have to run some expensive computations periodically on some of the game objects(mostly AI related). It used to work well until I scaled up the number of active game objects, where the performance bottleneck showed up.My potential solutions are:1- Reduce the polling rate of the AI updates.2- Try to distribute the computing load between different processes and comunicate the output back to the main thread? (not sure that's why I am asking).3- Decrease the computation price cutting out some features.I'm still learning node API so I've checked several pages including node documentation and a bunch of tutorials but all of them use the same example(distributing load amongst child process in a htpp server) and I would really appreciate other types of examples, especially if they showcase how to properly comunicate different types of data structures between processes.So if you got any resource or insights to share about this topic I would really apreciate it, thanks!

Submitted December 30, 2017 at 01:12AM by Valaelys

Proper Way of handling Database Requests

Hello, first of all, i'm new to NodeJS and Javascript.I have a Question regarding Database requests. Currently, i'm trying to run a forEach-Loop to look for specific Informationen from the Database. During each loop-run, i invoke a function to run a query on the DB and with the results to instantiate a new Object and push it into an Array.If i would run my Style of Code in Java, it should be fine, but somehow i end up with an error, trying to access a Method of an undefined newly created Object. I think there is a Concurrency Problem.If more information regarding my Code is needed, i'm happy to provide that. Thanks in advance

Submitted December 29, 2017 at 11:54PM by cwFry

Issues with Express Server-Side Routing

I made this post on a different subreddit not too long ago, but I think it may be better suited in this subreddit. It is more of an express-related question than a node-related question however. Anyways...My issue stems around strictly the '/' route (root route?). When a user connects to my site, I check to see if there's session data on the said user so that he/she doesn't always have to re-log when the browser closes. If there is no session data on the user, then my website will be redirected to the signup router. That is what the coding snippet below illustrates on my node/express server file.Let's assume my website is www.example.com. If I go to www.example.com/buy and I don't have any session data on the user, the website automatically redirects to http://ift.tt/1o9Omiw as expected. The same will happen if I typed in www.example.com/sell and no session data exists. But if I typed in www.example.com, the url doesn't get redirected to http://ift.tt/1o9Omiw. Why is this and how do I make it follow the same behavior as the other routes?app.get('/signup', (req, res) => { if (!req.session.auth) { res.sendFile(path.join(__dirname, 'client/public/index.html')); } else { return res.redirect('/'); } }) .get('*', (req, res) => { if (req.session.auth) { res.sendFile(path.join(__dirname, 'client/public/index.html')); } else { return res.redirect('/signup'); } }); Thank you

Submitted December 29, 2017 at 11:12PM by dotobird

How much load NodeJs (Express) will take on the following dedicated server?

8 Dedicated x86 64bit Cores32GB Memory50GB SSD Disk250GB Direct SSD Disk1 Flexible public IPv4800Mbit/s Unmetered bandwidth5Gbit/s Internal bandwidth

Submitted December 29, 2017 at 08:43PM by Indu_Pillai

Twitter: Time to switch HTTP libraries? (phin)

https://twitter.com/ethanent/status/946818308623314944

Submitted December 29, 2017 at 07:01PM by Etha_n

Comparing prodcutivity of node.js frameworks

http://ift.tt/2CnLUkQ

Submitted December 29, 2017 at 08:09PM by ratneshsinghparihar

Thursday, 28 December 2017

Sending an error to Request

Hey everyone, I have a question about http error objects, specifically when using node and the Request module.What kind of object do I send to the Request callback function so that it shows up as the error object?My Request call looks like this:request({ url: url, method: 'GET' }, function(error, response, body) { // HOW DO I GET an 'error' HERE???? } That is pretty straightforward and it works fine with the api I wrote, which looks like this:User.findOne({_id: req.params.id}) .then(user => res.status(200).send(user)) .catch(err => res.status(500).send(err)); The problem is that the Request call above never receives an 'error' object no matter what I do. When the last line of the api sends back 'err', it is received by Request as the 'body', not the 'error' object.I have messed around with that line a bunch, like creating a new Error object and sending that back, or changing the status code, or sending a custom object. Nothing seems to ever show up in that error object in the Request callback function.The Request docs say that an error would come from a http.ClientRequest object, but I couldn't make much sense out of that.Any guidance here is appreciated. Thanks!

Submitted December 29, 2017 at 06:21AM by ithurtsbutitsworthit

phin - the lightweight Node.js HTTP client

http://ift.tt/2iIVLfD

Submitted December 29, 2017 at 05:32AM by Etha_n

Twitter status: New year's resolution: Clean up node_modules. (request, phin)

https://twitter.com/ethanent/status/946553324819513344

Submitted December 29, 2017 at 01:29AM by Etha_n

I am trying to enable cross-domain-requests in my Heroku app, but I keep getting a 503 status error

http://ift.tt/2DtGFzq

Submitted December 28, 2017 at 11:20PM by LetsBrigadeBitches

My new lib: Burgerlog

http://ift.tt/2pRwQsX

Submitted December 28, 2017 at 09:26PM by henriquesosa

Looking for help to start a new Node / Angular 4 project

I already have a moderately decent background in these languages. But I need someone to support me, teach me a few things and maybe even help execute a few tasks. I'd love to speak with someone who has the knowledge and experience. I'd be glad to pay for your time!

Submitted December 28, 2017 at 10:08PM by snahrvar

πŸ’ΈπŸ’» CLI for checking Bitcoin value - Any feedback?

http://ift.tt/2Cij9Z2

Submitted December 28, 2017 at 10:11PM by knutkirkhorn

What packages should I be looking at for user/account management?

Node JS newbie here. I'd like to add local authentication (username + password) to apps, without spending a load of time writing the 'boring stuff'.I've looked at Passport, but it seems like it doesn't have routes or functionality for password reset, etc.What do you all use?

Submitted December 28, 2017 at 06:16PM by missstar

Node from command line: fatal error - cygheap base mismatch detected. How to troubleshoot?

TL;DR Running Node from my command line, I occasionally encounter an error: fatal error - cygheap base mismatch detected. How can I troubleshoot this further--is it a Node issue, Git issue, Cygwin issue, or related to something else?Hi all, new to Node.js here. I am trying to contribute to an open source project (project here) that is written in JavaScript and requires Node.js to run. On my system (Windows 10), I can now edit source code and run the program via the command line. But whenever I introduce an error to the source code, half the time the error in-question is displayed in my command line window as expected (screenshot), but the other half of the time the same error occurs:$ NODE_ENV=development node bin/cli.js game -t 1 [main] winpty (6384) C:\Program Files\Git\usr\bin\winpty.exe: *** fatal error - cygheap base mismatch detected - 0x6429D408/0x113D408. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. Approximately half of the time I encounter this error, even if I remove the error in the source code and re-run the same command, the same error is displayed. When this occurs, I have to then restart my console (Git Bash in this case), or reboot my entire computer. How can I resolve this? I'm not sure if this is a Node issue, Git issue, Cygwin issue, or something else :-/I have followed the instructions in the error message, and confirmed there is only one cygwin1.dll, which resides in C:\cygwin\bin.When the issue began, I did not have Cygwin installed on my system. So I installed it (with all of the defaults), yet the issue is still present.I am using Node.js version 8.9.3 and npm version 5.5.1.Thanks in advance.

Submitted December 28, 2017 at 12:27PM by cag8f

Build Custom "Serverless" Push Notifications for Any Website in 6 Minutes with StdLib and PhantomJS

http://ift.tt/2BPm1cN

Submitted December 28, 2017 at 10:03AM by J-Kob

Comparing performance of node.js frameworks

http://ift.tt/2lbvnZI

Submitted December 28, 2017 at 10:32AM by ratneshsinghparihar

using koa and koa-websocket, is it possible to emit an event from anywhere in my app to broadcast over the websocket channel?

The websocket channel is defined inside app.js but I have other libraries that need to somehow broadcast to it. Should I just pass the koa app object around to do that? or is there a smart event broadcasting across my entire library I can integrate somehow.

Submitted December 28, 2017 at 09:04AM by nothingduploading

i need a free flight prices api any suggestions ?

i need a free flight prices api any suggestions ?

Submitted December 28, 2017 at 08:53AM by kamedan123

Releasing node-data 2.0 (production ready node.js framework)

http://ift.tt/2E43c7b

Submitted December 28, 2017 at 07:47AM by ratneshsinghparihar

Wednesday, 27 December 2017

Good video on technical debt for non-techies

We do a weekly lunch-and-watch-an-interesting-youtube-video thing and I would like to do one on technical debt. I know I've seen really good explanations/analogies but can't find much now.Hoping for something accessible to non-coders, 8-20 minutes and that does a good job explaining what technical debt is, how it happens and why sometimes the dev team spends a sprint "fixing" things that are working fine (or conversely, why some things cannot be fixed without spending a whole sprint on them).

Submitted December 27, 2017 at 11:33PM by user59873

I can't make a Successful POST API Call via Axios in my React-redux project. Can anyone help me out?

http://ift.tt/2DoDPeP

Submitted December 27, 2017 at 09:53PM by LetsBrigadeBitches

Updating state of a parentless component in React – Arun Michael Dsouza – Medium

http://ift.tt/2DkW1WI

Submitted December 27, 2017 at 08:11PM by amdsouza92

How can I do my own email platform?

Hello, I want to have my own email platform like Gmail or Outlook, I count with my own domain, and solutions like roundcube and others (included in my cpanel) are really ugly, anyone have some tutorial for create an email platform?Will be only for my personal use, and learn more about node.js, It will not be for professional use.

Submitted December 27, 2017 at 02:54PM by MagoMerlin

Monitor files and see who (+ network computers) changed a file.

are solutions like fs.watch or chokidar able to tell who changed a file?

Submitted December 27, 2017 at 11:49AM by unr3al011

Tuesday, 26 December 2017

Performance implications if next is not called in the middleware?

In the middleware function, to move on to the succeeding middleware function, we need to invoke the next function. As we all know, if we omit the call the next() function, the request will be hanging. In these scenarios, are there any performance implications due to this? If yes, then what are those issues? What might be the issues if we do not explicitly call next function and requests are left hanging?Thank you.

Submitted December 27, 2017 at 12:34AM by nodexplained

Where are GREAT GREAT Cheap or EVEN FREE NodeJs with at least MongoDB hosting?

No text found

Submitted December 26, 2017 at 05:46PM by GoogleSearch-Arma2OA

Deploying my node app

I have a personal portfolio page I am trying to deploy. It is a create-react-app that will be served by an express server. That express server will also handle sending emails from the 'contact me' form.Here is the app so far if anyone is curious: http://ift.tt/2BDT97a am working on the deployment method since I have never really deployed my own app, and I don't want to use Heroku because I am working on learning more pieces of the deployment process. I am curious about:Should I use docker?What are some cheap hosting services? (I won't get much traffic)How do I set up a password for the email service that isn't posted on github?

Submitted December 26, 2017 at 02:33PM by sambigelow44

Fundraising service

My electron app https://dotavision.ru/ Which service to raise funds would you recommend? html iframe with the purposes of the donations

Submitted December 26, 2017 at 01:34PM by DEEEZIGN

How to use two cookies for user sessions (expressjs)?

When handling user sessions, I want to keep http-only cookie security benefits while also allowing the users to sign out (delete the cookie) when they are offline or server is not available. This StackOverflow answer suggests to use two cookies for this. Both cookies should be required for a session to be considered valid, and one of them can be removed by the client at will.However, as I understand, express-session only uses one cookie. Is there a way to use two cookies for sessions (one http-only and one not-http-only) and keep it interoperable with other middleware (like express-session, passport, etc)?

Submitted December 26, 2017 at 11:43AM by smthamazing

TCP Emitter

http://ift.tt/2lcCRuX

Submitted December 26, 2017 at 12:28PM by taboneIO

How to access Node.js console module?

Hi all, new to Node.js here. I am trying to contribute to an open source project (project here) that is written in JavaScript and requires Node.js to run. I have installed both Node and the package in-question on my system (Windows 10), but I can't seem to run the package and have access to the Node.js console module at the same time. How can I do so?The package is command line based, and to run it, from my terminal (Git Bash), I run a typical command (e.g. game -t) with the syntax:NODE_ENV=development node bin/cli.js game -t But when I do this, I can't seem to access the console module (I encounter a bash: command not found error). I can only access the console module after I explicitly enter the Node environment, with the node command. Once I run the node command, I then enter an environment that recognizes my JS commands, including console.log(). But I'm not sure how to run the package in-question from this environment. How can I run the package, but also view console output at the same time?FYI I am using Node.js version 8.9.3 and npm version 5.5.1Thanks in advance.

Submitted December 26, 2017 at 12:36PM by cag8f

JavaScript achievements of the Year 2017 and key Frontend’s trends

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

Submitted December 26, 2017 at 08:15AM by r-wabbit

Monday, 25 December 2017

Node.js CLI options parser.

http://ift.tt/2C4Kwne

Submitted December 26, 2017 at 03:27AM by JorgeBucaran

Am I understanding how to handle data in microservices correctly?

I'm trying to understand how to implement microservices.I read this: http://ift.tt/2l9ChxP well as many other articles. It seems like the idea is you should separate concerns, and each microservice should have its own API and database. Also, microservice A cannot access microservice B's database directly, but has to do so through B's API.With that in mind, I came up with this:Accounts microservice with its own db - used for logins id(pk) | email | password Identity microservice with its own db - displayed in profiles user_id(pk, fk) | username | first_name | last_name Billing microservice with its own API/db - deals with payments user_id(pk, fk) | customer_id Where I'm unsure is what happens when a user registers? Assume we're not dealing with Billing here.It sounds like you have to create a row in both the Accounts microservice/db AND in the the Identity microservice/db?So:async signup(email, username, password, first_name, last_name) { // Accounts API -> insert email, password into Accounts db and return new user_id // Identity API -> insert new user_id, username, first_name, last_name into Identity db } async getProfile() { // Identity API -> get current user's username, first_name, last_name by user_id from Identity db } What happens if one these happens to fail during signup e.g. Identity? In that case, say if that user tries to login -> fetch their profile next time, they don’t have one (because it's missing from Identity)? Then you have a user account with no profile/identity attached to it. What should happen then to make sure things are still working/repair themselves? I mean I guess this could happen in a monolith too with one database, but probably less likely.Am I thinking about microservices correctly? How would you deal with all of these possible database integrity issues?

Submitted December 26, 2017 at 01:19AM by roachgirl11

Generate PDF report from REST API

I have a REST API using Express and mongoose. I need to generate some tabular reports in pdf, but the libraries and packages I was testing(pdfKit, voilab-pdf-kit) don't let me add style to the table of the reports. What is the better approach to generate pdf file with style and images?Thanks in Advance

Submitted December 26, 2017 at 12:45AM by joseleg176

Lack of web request context - anything new?

So Node/Express are maybe the last web frameworks in the world where we can't store per-request variables (e.g. user id, roles, transaction-id, etc). Without passing Express req all around and cluttering our app. Did anyone find any elegant solution to this?

Submitted December 25, 2017 at 07:26PM by yonatannn

How do you validate input (many options inside)?

The most important part is 'why' you use what you use.JSON Schema http://ift.tt/2pvVZt1 http://ift.tt/2DKViPT if-else-throw 'rules'!!Validation is for little girlsTyped classes (e.g. Typescript)npm 'validator' http://ift.tt/1NKzCQS

Submitted December 25, 2017 at 05:27PM by yonatannn

Microservices: where is the service client?

Multiple microservices are consuming service A via plan REST HTTP. They all use the same http client code for approaching service A -gets params, invoke http methods. Where would you define/put that client? for example (a) dedicated package they all import - serviceAClient (b) duplicate this code, it's short (c) other ideas?

Submitted December 25, 2017 at 05:14PM by yonatannn

'Several instances of node' or 'just using Cluster' for real-time multi-user applications.

I have a multi-user socket.io program where up to 15 people can form a room and chat, draw, and more. Obviously, for a high amount of users I would want to utilize multiple processors (CPU threads), so naturally I should be using node's Cluster.However, I am not sure about it. Right now my program runs on a single processor, and user rooms are basically arrays with which I use socket.io to send a room's information to its residents. If I use Cluster, how exactly will it divide those rooms on the processors? Say I have a 100 rooms (an array of 100 room objects) with 10 users on average for each. Will I just write the code as if it is running on a single processor and let Cluster do the rest? Do I even need to care about this from a performance perspective?What I do know is that if I run several instances of node.js, and redirect new incoming users according to congestion/user's preference, then I will be sure my program will work exactly how it works right now on a single processor. I don't want to use this though since I will need several ports (as far as I know).

Submitted December 25, 2017 at 05:10PM by matazabubu

Instagram bot to automatically like your Gf's posts and notify you on Slack

http://ift.tt/2B9tJBS

Submitted December 25, 2017 at 09:09AM by gulzar21

Sunday, 24 December 2017

Problem from StackOverFlow, Node Inspector is locked and I cannot release it

Hey guysSorry for dragging this problem over here, but I have been console.logging as my only method of debugging now for like 5 hours!! anyone have any advice, I would appreciate it thankshttps://stackoverflow.com/questions/47965319/node-or-vs-studio-will-not-release-nodes-debugging-web-socket

Submitted December 25, 2017 at 04:31AM by amberpatrick

socket efficiency question

Would it be more efficient to have my socket listen to 10 different event listeners, or have 1 event listener receive 10X as much data?

Submitted December 24, 2017 at 11:34PM by moomoocowjonny

Best way to implement "live" streaming video?

I am planning on making a website for my friends where we can upload videos to it, and the videos get played automatically by the server so that everyone watches the same video at the same time. So essentially it is "live" streaming, except the video that is being streamed is pre-recorded.For example, if my friends are watching a video, and they are halfway through it, and I connect to the website then I should be at the same exact part of the video that they are at.I followed this tutorial on how regular video streaming works, and I understand the process, but now I would like to implement this in a way that when you join the website, you only start receiving the stream from the part that everybody else is on.I am familiar with Socket.io and I was thinking I could use that, but the tutorial that I found uses regular requests to send the stream data, and I'm not sure how to implement it using websockets (if that is even possible).So my questions are:What is the best framework/tools in NodeJS to accomplish this type of livestream?Is NodeJS a good way to design something like this, or are there better alternatives? (I would like to potentially be able to scale the site, so that tens of thousands of people could be watching at a time. How do websites like twitch accomplish this?)

Submitted December 24, 2017 at 06:15PM by PootPeet

Your Node.js authentication tutorial is (probably) wrong

http://ift.tt/2up1tIk

Submitted December 24, 2017 at 07:03PM by rawnlq

abjscdef - A Better JavaScript CD Encoder (FLAC) Concept

Hi gang! First time poster, long time lurker :)This Christmas (2017), I got super bored and figured it would be neat to re-engineer a classic audio ripping shell script (abcde) in Node. My Node-fu is relatively weak so I thought this would be a good exercise of long dormant muscles.I've noted that many open source projects come to life w/little in the way of external input, and since none of us are as smart as all of us, I thought it would be interesting to try and get feedback at each stage of the implementation process--concept, design, implementation, etcetera. I would then link git repo back to this (and w/luck, future) reddit posts as a way of community documentation.I thought I'd start by sharing the overall concept:http://ift.tt/2DJ9tEY since concepts can be super boring, there's also some initial code:http://ift.tt/2pqseKg do folks think? Any conceptual ideas/tips/tricks before I start getting into the hard stuff?

Submitted December 24, 2017 at 03:02PM by ConstVoidBlog

Dota 2 get drafts

Maybe somebody knows, how can I legally get drafts in the current game (draft stage)? My app https://dotavision.ru/

Submitted December 24, 2017 at 02:02PM by DEEEZIGN

Lightweight API gateway for home-scale projects

http://ift.tt/2BMnxjF

Submitted December 24, 2017 at 02:25PM by sinedied

Javascript Fetch Api Example - A Real World App

https://youtu.be/0bec1BmeY4c

Submitted December 24, 2017 at 12:16PM by johncenasucks123

Saturday, 23 December 2017

Socket.io efficiency question...

Would it be more efficient to have my server listen to 10 different sockets, or have 1 listening socket receive 10X as much data?

Submitted December 24, 2017 at 06:16AM by moomoocowjonny

Question about managing node.js installations

This question pertains to macOS High Sierra.I installed node & npm through the official installer (http://ift.tt/1UAOY2Y).After installation, I started doing some reading about how to manage node packages and I found a lot of discussions about how to install node and npm. The advice is all over the place and I'd like some advice before I go too deep.Some people recommended using Homebrew to install node and npm, but a good amount of people also said that this leads to major issues. The general sentiment is that you shouldn't use a package manager to manage another package manager. I've heard that before with other tools.Other people recommend using nvm to manage node versions. This looks pretty simple, but I don't really think I'll need to manage a bunch of node versions -- I just want to stay up to date with the latest node version.Not many people recommended using the official installer. Of course, that's what I did before I went down this rabbit hole.What is the best way for [i]most people[/i] to install node.js, npm, and additional JavaScript packages?Is there any sane way to uninstall node.js and npm is you used the official installer? Every resource I've found describes a hideous process...

Submitted December 24, 2017 at 05:33AM by pypy_question

Nodejs project structure

I've done numerous tutorials on Nodejs and seen a few repos. What I've noticed is that they all somewhat vary in structure but the logic is still there.I was wondering which one you think is best and which ones are more common in professional environmentshttps://github.com/codyseibert/tab-trackerhttps://github.com/NeverSa/vueorhttps://github.com/wesbos/Learn-Node/tree/master/stepped-solutions/45%20-%20Finished%20AppI'm developing a project in the coming weeks and I'd really appreciate the help, thanks

Submitted December 24, 2017 at 04:39AM by BBaa55

Electron and passing data to render processes.

I am trying to get information from a text box in one window then send it to the main process and back to the main reader window.If anyone could help that would be great. ThanksMain JS file: http://ift.tt/2BIdhsC HTML to Main JS: http://ift.tt/2zmc5Fk

Submitted December 24, 2017 at 01:48AM by Potofpie

Writing a Good API Wrapper?

Hi all,Looking for any standards/guides to write an API wrapper for my applications that I can publish to NPM or something.My thinking is that I essentially replicate the methods I use in the routes (like userHandler.getById()) into model methods (like API.user.getById(), translating on either side into AJAX or responses.What do you think? Do you ever write wrappers for your APIs? Do you follow a standard.Appreciate any help!

Submitted December 23, 2017 at 09:59PM by Crowesco

Integration of Google Sign-In in JavaScript full video

https://youtu.be/qzq0kEUa5lU

Submitted December 23, 2017 at 06:53PM by johncenasucks123

How to create a readable stream from a writeable stream?

I want to convert a csv file to json. For that I need a readable stream:const csvReadStream = fs.createReadStream(file.path); Now the problem occured, that I need it in UTF8. The conversion works well with: const csvReadStream = fs.createReadStream(file.path) .pipe(iconv.decodeStream('iso-8859-1')) .pipe(iconv.encodeStream('utf8')) .pipe(fs.createWriteStream(file.path + '_new')); My problem now is: how do I create a readable stream from the new file / writable stream?const csvReadStream = fs.createReadStream(file.path + '_new'); doesnt work unfortunately. I would appreciate some help!

Submitted December 23, 2017 at 04:28PM by Shovez

Retrieve data from an Adafruit 9DOF via nodejs npm i2c-bus

I have been stuck on this for the past few days. I am attempting to get an Adafruit 9 DOF sensor to read on my i2c bus. I am trying to avoid having multiple masters. Currently I am able to communicate to my node async server with the hardware, but that is through an arduino master that is also on the i2c network as a slave.Does anyone have any suggestions on retrieving the data from the adafruit sensor as a slave to my node server via i2c?I am using the npm i2c-bus

Submitted December 23, 2017 at 02:48PM by QuantumObstructions

Grind - Laravel Inspired Node.js Web/API Framework

https://grind.rocks

Submitted December 23, 2017 at 01:21PM by cecplex

How do I make something respond to one word in a sentence?

I am using Node JS and Discord JS. I am trying to make a bot respond to a word within any sentence but I can only make it respond to the word in a stand alone sentence. Can anyone tell me what I am doing wrong?Pastebin: http://ift.tt/2BVwVOZ

Submitted December 23, 2017 at 12:33PM by UnderIntact

Firebase Cloud Messaging: Handling tokens and notifications with Node.js

http://ift.tt/2BoNp0F

Submitted December 23, 2017 at 09:24AM by nulless

Any noob friendly tutorials on how using PSQL in a Node app from start to deployment?

I did a tutorial on Udemy about Node/PostgresQL which was not bad, but it didn't include a section on how to deploy your database to Heroku.I've been reading around the official docs, the node-postgres docs but it's incredibly confusing. Reddit search tells me that I should be using one of Bookshelf/Knex/Sequelize too (no idea what any of them do exactly tbh), which is now making my head spin more.All I want to do is crawl back to MongoDB! But I'm determined to learn PSQL because it's apparently a safer DB to use.So - can anyone please kindly point a noobie like myself to the correct resources to learn how to create and deploy a PSQL database for a Node app?

Submitted December 23, 2017 at 08:57AM by drhectapus

Friday, 22 December 2017

Wondering how to render my Pug mixin from the client.

Hey, I have some ajax that gets items for my page.Since its client-side, is there a simple way to iterate over it and render it via a mixin file instead of sending normal html like this:I saw the API doc but I don't quite understand how to do it, especially how to send the Pug runtime, maybe if I could just use the Pug syntax there that would be cool too, thanks :)import { $ } from './bling'; $('.store__items').innerHTML = response.data.map(item => { return `
${item.name}

${item.description}

${item.name}
`; }).join('');

Submitted December 23, 2017 at 04:43AM by theweedlover420

`for-await-of` and synchronous iterables

http://ift.tt/2zIHEtW

Submitted December 23, 2017 at 04:09AM by fagnerbrack

Node.js chart rendering with C3 and Nightmare

I've been doing a lot of data analysis in JavaScript. It makes sense for me to work in JavaScript, because I already use it and that's where my visualizations normally end up. JavaScript has a very rich ecosystem of visualization libraries so that's not surprising. All these visualization libraries are browser based... which is great if that's where you want your visualization to be. It's not so great if you just want to render a chart to an image, say to store for later or to include in some kind of report.I wanted to be able to render charts from the command line. I wanted to be able to render charts from a headless server. There seems to be no charting or plotting library for JavaScript that supports this directly. We can however approach this indirectly and in my new blog post I'll show you how to render charts from Node.js. It's not as easy or convenient as we'd like but it is possible using a browser visualization library coupled with a headless browser.Please read the blog post to learn how to render charts and other visualizations using C3 and Nightmare.http://ift.tt/2Bngslz

Submitted December 23, 2017 at 12:53AM by ashleydavis75

bash: npm: command not found in Debian 9

http://ift.tt/2BCevG8

Submitted December 22, 2017 at 10:50PM by NewbieRPiGuy

How to run a Node app as a web server?

Really simple question -- if I want to run my domain on a Node backend, do I just nodemon app.js and have express listen to port 80?All my experience with Node has been on the dev side. I have no clue what the team that builds and deploys does to make it viable on the Internet. They probably don't nodemon, but I was considering doing Nodemon so I can just upload TypeScript files and build and not have to worry about re-deploying.Are there advantages to doing tsc to build and then node to run it, as opposed to running tsc in watch mode and nodemon to watch? I guess it's more efficient to not have to keep scanning for file changes, but how much does that matter? It sounds nice to be able to just throw up new TypeScript files with FTP and it just be done, instead of SSHing in to re-deploy.

Submitted December 22, 2017 at 11:22PM by throw_at_work_away

Download a file with Node?

I am relatively new to Node and had a conceptual question.I will have an application generating a file (e.g. an HTML file) -- that application may be another Node app, or a PHP app running on Apache, or what have you. It will likely run on the same server as this second application I am wanting to make, but it may be on a different server just for extensibility purposes. I want to get the contents of that generated file, e.g. file_get_contents('localhost:8010/generated-file.php') or file_get_contents('some-other-domain.com/'). How would one go about doing this efficiently? I was looking into reading files with fs, but it only supports file://, not connections of HTTP.Is there a standard or optimal way of doing this? Is there a better way to do it for calls specifically to localhost than over the internet?Thanks for any help.

Submitted December 22, 2017 at 10:04PM by throw_at_work_away

New to node.js, can I get some help!!

Hi everybody I'm new to Node.js I tried to learn it before but I just didn't understand it, I hope that someone could guied me through the learning path, what should I start with, what I should know before and where could I find some great courses.

Submitted December 22, 2017 at 08:39PM by mehdibahsain

Opinions on my current authentication method, (undergoing development, can be changed!)

Right. I’m developing a sort of database using a caching server and JSON, with a structure that is as database-like as I could get it. For fun, thought it would be a neat project.Need an opinion. Currently, you can only run operations (query, set, etc) on a database if you provide the randomly generated 48 character long alphanumerical string and it matches what’s in the database. Otherwise you can’t. Do you think that’s enough security? The random key is sent back to the client as a response, and will be sent to the API for every query.Will be over HTTPS, so will of course be encrypted.

Submitted December 22, 2017 at 06:49PM by OzziePeck

How does ClusterWS scale Websocket? (Part 1 CPU scale)

http://ift.tt/2BQFhY3

Submitted December 22, 2017 at 05:19PM by goriunovd

RisingStack Best of - The Most Popular Node.js Tutorials of 2017

http://ift.tt/2BQ2klG

Submitted December 22, 2017 at 03:49PM by andreapapp

Best way to communicate from a worker to web layer that work is done?

I've been having some fun doing Node-based setup employing workers and message queues to do stuff. I have a web process, essentially an API, that can receive calls and will, based on these, add work to be done to a queue. Workers consume the queue, doing the work. Now, in some cases, that's really all I need. Great. However, in other cases, I need the web process to show the new data when it's available. Before I do this part, I want to check if I've got the right idea for it. I want to know what the generally accepted best practice for this is.So far, what I believe should happen is this: Workers update some storage (cache/DB) that the web layer depends on, meaning all future data will be the updated data.I assume that a cache can be set to emit an event when a key's value changes to facilitate live-updating lists. I'm also in doubt if this is the best solution, if it's possible, so would love to hear what people have done/recommend.PS: This isn't very node-specific, for which I apologize. I just usually work in node, and didn't really know which other subreddit to go ask this question on, so here we are. :)

Submitted December 22, 2017 at 11:09AM by Maharyn

I just wrote "Refactor Node.js Routes with Testable, Functional Concepts like Composition, Currying, and Clojure". Maybe you'll find it interesting :)

http://ift.tt/2zbQKyx

Submitted December 22, 2017 at 06:21AM by danydughy

Thursday, 21 December 2017

WordPress or Node.js for a comparison website?

I'm to build a comparison website for web hosting. Which way do you think would be great? I have heavy consideration about performance, ability to customize and more control over the site with tons of dynamic actions with the web server.If you were to pick one of these, what would you pick and why?

Submitted December 22, 2017 at 04:05AM by tharindutpk

New Release of Node.js Module for Oracle Database: node-oracledb 2.0 is out

http://ift.tt/2BkWgjW

Submitted December 21, 2017 at 11:42PM by brunocborges

How Do I: Create CRON based scheduling service for multiple user accounts

I'm trying to create an app where users can schedule automatic emails, or tweets, or w/e to be sent out on a schedule. Each individual user has an admin panel where they can update their own schedules.My question is about how I can do this in a well-tested, performant manner.Option 1: I know I can open a new cron task for each user, and update it anytime I need to, and even destroy it when I need to, but I wonder if I have 100 users, that means I'll have 100 individual cron jobs running. That sounds like it could be an issue pretty quickly dramatically slow down the server.Option 2: I don't even know if this is possible but... something along the lines of having a single cron that records all tasks for all users, so then when a task needs to happen, it can run that task for each user it needs to. So maybe at noon, on Tuesdays, it gets an email from user A and a tweet from user B and sends those both off to their respective services. Is that possible?I'm open to other ideas as well. I've never attempted something like this, so I just have no idea...Stack: Node, Express, PUG, etc etc Cron Job provided by http://ift.tt/2teQFKz

Submitted December 21, 2017 at 10:53PM by SableElephant

Failing to Test URL for Validity When Cert is LetsEncrypt

I am having a problem with the following code to test for a valid URL in v6.10:exports.validURL = function(url, validURLCallback) { try { var https = require('https'); var req = https.get(url, (httpResp) => { validURLCallback(httpResp && httpResp.statusCode && (httpResp.statusCode.toString().startsWith("2") || httpResp.statusCode.toString().startsWith("3"))); }); req.on('error', (err) => { validURLCallback(false) }); req.end(); } catch (err) { validURLCallback(false); } } Basically it's getting an HTTP 403 (forbidden) error

Submitted December 21, 2017 at 10:30PM by stankbucket

Content generator, MicroDSL

Content generator, takes the structure of any mysql database and automatically creates web forms, ORM models and many other custom content.http://ift.tt/2BNletE

Submitted December 21, 2017 at 06:29PM by anlijudavid

V8 JavaScript Engine: V8 release v6.4

http://ift.tt/2kJYene

Submitted December 21, 2017 at 05:40PM by _bit

How do I update only one of a package's outdated dependencies?

I have a library of Vue.js components that are independently versioned and are separate packages on an Artifactory instance. I want to add an "all " package that declares all of these independent packages as dependencies. Now say that I update 3 of these independent packages. Is it possible for a person consuming this "all" package to update a single dependency instead of all 3 of them ?Thanks in advance.

Submitted December 21, 2017 at 04:57PM by rzrbck

Heavy-lifting is a design platform, focused on the creation of complex component, assembly and report design. Heavy-lifting is designed to develop complex cataloguing systems. Built with mongodB, NodeJS, expressjs and Handlebars.js and designed for flexibility. Looking for contributors!

http://ift.tt/2uhnDI1

Submitted December 21, 2017 at 12:38PM by jdav89

node.js sorting object (mongoose, express, ejs)

/* SOLVED */i have this problem sorting my object of data in my index of my blog app. I have a blog app based on Express using ejs and mongoDB using mongoose. What i want is sorting the results so the newest post starts at the top. At this moment it will show the first post at the top.app.js / mongoose schemablogSchema = new mongoose.Schema({ title: String, image: String, body: String, created: {type: Date, default: Date.now} }); var Blog = mongoose.model("Blog", blogSchema);app.js / Index routeapp.get("/blogs", (req, res)=>{ Blog.find({}, (err, blogs)=>{ if(err){ console.log("Error!"); console.log(err); } else { res.render("index", {blogs: blogs}); } }); });index.ejs foreach<% blogs.forEach(function(blog){ %> img <%= blog.title %> <%= blog.created.toDateString() %>

<%- blog.body.substring(0, 200) %>...

Read More <% }) %>Does anyone have a clue how i can do this?I also have this posted on stack overflow where its easier to read the code: http://ift.tt/2BpEdxf

Submitted December 21, 2017 at 08:07AM by bjelke2

Tons of memory

Hi guys. My api is using 3/4 gm ram. Is it normal? It's supposed to be microservices? How do u guys deal with memory?

Submitted December 21, 2017 at 08:58AM by Revlack_br

Sequelize, Bad Handshake

Good morning guys,Trust you are all doing well.I am coming across quite a peculiar issue using Sequelize, maybe one of you have seen it before. I have setup a new MySQL server on a VPS that I am renting and I am trying to connect from my node app through Sequelize to that server. But I am coming across a Bad Handshake error.The VPS is not hosted on Azure, and those are about the only errors I can find on stackoverflow regarding this. There is no TLS/SSL enabled for MySQL so I can't imagine it being certificate related. I can make between 3-5 queries before this happens, so it isn't immediate. I have been able to make 10-12 queries before it has happened as well.I have done the same request on the MySQL server itself without any issues.I have created a stackoverflow question as well where you can find the relevant code as well: http://ift.tt/2CN0W2I any of you possibly come across this before?

Submitted December 21, 2017 at 07:57AM by thezadmin

Wednesday, 20 December 2017

Martin Shkreli is (was) on Github and has an unfinished gangster MUD - "Traphouse"

http://ift.tt/2p0uyra

Submitted December 21, 2017 at 12:00AM by isunktheship

poky - delay with promises in Node

http://ift.tt/2BIFKvq

Submitted December 21, 2017 at 12:55AM by Etha_n

How to add Metadata to FLAC Files using NodeJS?

I've tried a couple modules in github, but couldn't get them to work.Basically I have a FLAC file that doesn't have Tags, and I would like to be able to add them into it, with the album art.How can I possibly do this using NodeJS?Thanks in advance guys.

Submitted December 21, 2017 at 12:56AM by marquesini

Scraping live webpage data?

Any suggested libraries able to watch a page and scrape updates as well? If the site has a DOM element say #listitems, ideally would like to monitor this and have a callback anytime that data changes but seems like most scrape libraries are one request, load data, and then end the request from what I can tell.

Submitted December 20, 2017 at 09:56PM by boxxa

How To HACK A Node App (Presentation/Talk)

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

Submitted December 20, 2017 at 08:33PM by ptusa

Searching for a Node.JS mentor

Hello, I have been learning how to code in Javascript on my own for a while now (about four months), but I'm at a point where I'd really love to have someone mentoring me, to give me even more focus and direct me right from the start on how to write clean, efficient and workable code. Tools I'm interested in leaning are Node, Express, Chai, Angular, but other suggestions are also welcome. A great session would be pair programming with you, helping me achieve the projects I have in mind for my portfolio. These include a simple personal website with a nice animation on the homepage (Coding train style), and a great way to setup a web page, where I can play around with the UI and implement whichever framework I'm interested in. For the compensation, we can discuss an hourly fee together.PM me for more details, Thanks!

Submitted December 20, 2017 at 07:38PM by tallsamurai

Developing NPM Packages

http://ift.tt/2z49wI9

Submitted December 20, 2017 at 05:01PM by Ramirond

The ultimate guide to sending bulk SMS with Twilio and Node.js

http://ift.tt/2BmBdSv

Submitted December 20, 2017 at 02:24PM by philnash

Creating your first Node.js application with Node-Data

http://ift.tt/2kr7soU

Submitted December 20, 2017 at 12:42PM by ratneshsinghparihar

Express Session Question

Hello,I am setting up auth using Express Passport and Express Sessions, my app currently runs React on the front end, and Express on a different port. I'm curious as to how exactly sessions are set (Question Below)Are they set on my 'server' aka the express port, and then pushed onto the req object? Or are they set on the 'client' aka wherever my front end is hosted up on. Eventually these will be on the same port, but in development they are not. I'm finding that my cookies are being set on my express port, but not on my react port. Is this normal behavior? If so could someone explain why? If I set it save uninitialized then it appears on both ports. I'm trying to wrap my head around why it would possibly even need to store the session on my express port.Cheers, Hyden

Submitted December 20, 2017 at 11:02AM by dhyd

A little feedback...

Long time ColdFusion dev here, looking to branch out into newer technologies.I am working through a re-write of a legacy CF app I wrote about 8 years ago into Node, and I am just looking for some feedback on how I'm building my modules:- ie am I doing it correctly? Here's an example:http://ift.tt/2oW3Ks8 I be declaring my required modules inside the export?Are callbacks acceptable in smaller code? Or should I focus more on async/await?Should I end the connection inside the connection.query()?Should I even be using two connections as in the code snippet, or should I wrap it all into one and then close?As a side note, this module is working fine without errors, and serves the purpose it was written for. I just want to be sure im moving forward in the right direction while im still early in the project.Thanks for your time.

Submitted December 20, 2017 at 09:55AM by mattj85

The “Serverless” Casino: Build a Facebook Blackjack Bot in 6 Minutes with Node.js + StdLib

http://ift.tt/2z44k6W

Submitted December 20, 2017 at 09:32AM by notoriaga

A simple, clean, better and modular way to handle routes in Express js using Router instance

http://ift.tt/2CJ5Tta

Submitted December 20, 2017 at 08:22AM by nodexplained

Here’s what people in tech had to say about JavaScript when it debuted in 1995

http://ift.tt/2jM2K43

Submitted December 20, 2017 at 06:38AM by fagnerbrack

Tuesday, 19 December 2017

auto update

if anyone has experience with node.js and electron, we are looking for a working way to auto update a bot for twitch. if you can figure something out that works your name get credited on the website. reply here or dm me if you want to apply

Submitted December 20, 2017 at 03:47AM by UnsercoverOrange

What was the last thing you built in Node.js?

Would really like some better use cases of how people are using Node.js. Would prefer to hear about projects you work on start to finish, even if it got improved later on after you proved initial value.As a bonus, what framework did you use and what part of that framework was lacking where you had to pull in another dependency?Thanks!

Submitted December 20, 2017 at 03:02AM by supergregmeme

I built a personal dashboard web app in Node, and I'd love some feedback!

http://ift.tt/2BbyCKW

Submitted December 20, 2017 at 02:25AM by johnjones4

Trying to create an application for a specific thing, is nodeJS the right tool?

I want to write a program that will open a website, open the chrome console, insert a string and then login to the website.I would also like to be able to do this multiple times with multiple strings and logins. And then I would like to run this through a GUI or terminal that gave me a response on whether the program worked.Would NodeJS be the proper tool to use for this or would I have to look into electron?

Submitted December 20, 2017 at 01:03AM by PalaceKicks

Fun with Node.js and more

http://ift.tt/2BgitE6

Submitted December 19, 2017 at 11:45PM by jesusgn90

I'm having a brain fart - How can I lock a project to a specific nodejs version, where it will tell me "unsupported nodejs version" or something like that.

We have an older React project that was originally built on nodejs 4.2.0 and recently ran into an issue with a developer running LTS and it wouldn't compile/run.I swear i've seen it before where a project is cloned from git for example and when you run npm install if the nodejs version installed isn't supported it will tell you its not supported and wont install anything or at least warn you.I tried definining:"engines": { "node": ">=4.2.0" } in package.json which to my understanding would allow anything minor/patch and below, but stick to the 4x major version. Even with 6x it still installs things, am i missing something here?

Submitted December 19, 2017 at 10:45PM by ndboost

Recommendation Node Frameworks?

Hey guys, I'm starting out an Node app which will be the back-end for the web, iOS and Android interfaces on this project (built through Ionic). I built my previous Node app just using Express. I'm curious if it's worthwhile to look into any frameworks for this upcoming project.Would love to hear your suggestion. And yes, I've already googled and done my basic research. I just want to get feedback from experience people from this community. Thanks!

Submitted December 19, 2017 at 06:42PM by snahrvar

SSH server with WebPack

http://ift.tt/2BeTp0i

Submitted December 19, 2017 at 05:07PM by Ivan_engnr

Developing RESTful APIs with Hapi

http://ift.tt/2kk9Yxl

Submitted December 19, 2017 at 04:36PM by Ramirond

Intro to Neural Networks with SynapticJS

http://ift.tt/2B1iwzd

Submitted December 19, 2017 at 04:11PM by cobalt_blade

A React app to vote for your favorite users!!

http://ift.tt/2kkbYFP

Submitted December 19, 2017 at 02:00PM by yTakkar

Any solutions of concatenating two and more base64 images to single base64 image?

Is it possible to do simple string concatenation to 'join' two and more base64 encoded images together to single base64 image?e.g.img1 w=100, h=200img2 w=100, h=200img1+img2 results inimg3 w=100, h=400

Submitted December 19, 2017 at 02:09PM by hbakhtiyor

Configuration library Configue reaches 1.0.0

http://ift.tt/2kJAI9H

Submitted December 19, 2017 at 10:01AM by AdrieanKhisbe

The Future of JavaScript Will Be Less JavaScript

http://ift.tt/2AppiCH

Submitted December 19, 2017 at 08:09AM by fagnerbrack

Monday, 18 December 2017

Oh, shit, git!

http://ohshitgit.com/

Submitted December 19, 2017 at 05:36AM by ratancs

Vaxic - the awesome, lightweight Node web framework

http://ift.tt/2i5A3lB

Submitted December 19, 2017 at 03:55AM by Etha_n

A Bitcoin/Ethereum/Litecoin dollar cost average bot I built with Node.js

http://ift.tt/2BGk5X4

Submitted December 19, 2017 at 12:58AM by WhiteRiceWill

Trying to implement jwt from a few sources, getting error:0906D06C:PEM routines:PEM_read_bio:no start line

It seems there is a problem with some certificates?Under the tutorials and documentation that I've read including node-jsonwebtokens very own, I haven't read anything about ssl-ing except for a few stackoverflow answers.I thought I could personaly set up a key instead of using 'shhhh' as many tutorials seem to choose. I created a file called private.key and made a crypric 42 length key. This code:console.log(`Acquired private key: ${RSA_PRIVATE_KEY.length}`); gets the proper length, but when I test my POST, I get the 0906D06C:PEM... error.Here is the code that is causing the error... let hash = response[0].password; console.log(`Hash from response[0].password: ${hash}`); bcrypt.compare(PASSWORD, hash).then(function(hashres) { // begin last step of validation if (hashres) { const RSA_PRIVATE_KEY = fs.readFileSync('./private.key'); console.log(`Acquired private key: ${RSA_PRIVATE_KEY.length}`); jwt.sign( {exists: true}, RSA_PRIVATE_KEY, { algorithm: 'RS256', expiresIn: 120, subject: response[0].userId.toString() }, (err, jwtBearerToken) => { console.log(`jwtBeareToken: ${jwtBearerToken}`); // <-- undefined console.log(`err: ${err}`); // <-- pem error here }); res.status(200).json({exists: true}); } else { res.status(400).json({exists: false}); } Note that I'm trying to do this async atm, rather then the sync way if that matters. If I do it syncronously, I still get the PEM error too.const TOKEN = jwt.sign( {exists: true}, RSA_PRIVATE_KEY, { algorithm: 'RS256', expiresIn: 120, subject: response[0].userId.toString() }); oh! and for the private key file(private.key)-----BEGIN RSA PRIVATE KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAytBCDJR5/6JAlB7ErBge 22YwN/u0K63wrnCMLde+hQQCYs7pBuYtbyxXF2PBFuHS+ytD9PSpY9t3NiGbk/9U s9GYCnqaK+vg2hz+T86LjJVkTJe0HWuE6g+HQ9GjyDGiO7ZBQw31HKxHYA2cMMVj tiO97VKLR9Fp6c6X33uNtdAaUZg57PjyNl6TjPwc52tJz8H5g0aV4tYelsTMaSSE 4nVwPLBoDzZaT84ktW1RuGToC4gEB/bctFrRBVaxp/KSebpds9P2xGMVweWgrvml cLnHGLKBxcCxh9kbgHS/nrgYXPjj92hxk2se/C7QmYeRSUs4ikEWO06NJ7Cgk+bQ 8wIDAQAB -----END RSA PRIVATE KEY----- EDIT:So I managed to get it working copy/pasting jsonwebtokens priv.pem. Why does theirs work and not mine?

Submitted December 18, 2017 at 07:53PM by le_throwawayAcc

Are Uncaught Exceptions a problem in production Node apps?

When these happen node exits and gets restarted by PM2, etc. But what happens to the clients? Are they dropped? And if so is this considered acceptable? (Thinking of big node users: Netflix, PayPal, etc)I would like to know if Uncaught Exceptions are a problem and if so, is there a solution?

Submitted December 18, 2017 at 08:39PM by grajagandev

EnvKey for Node.js: a 1Password-like service that keeps API keys, credentials, and configuration securely in sync across environments

http://ift.tt/2kGi6aC

Submitted December 18, 2017 at 05:30PM by danenania

Setup and Teardown database fixtures with MongoDB and Nodejs

http://ift.tt/2u64onA

Submitted December 18, 2017 at 05:38PM by coracarm

Serverless NodeJS: the fast, inexpensive way to build your next microservice

http://ift.tt/2kCdQc9

Submitted December 18, 2017 at 04:33PM by fptavares

Advanced Contract Testing - Pact Verification with Pattern Matching

http://ift.tt/2kfSvG3

Submitted December 18, 2017 at 03:50PM by andreapapp

Strapi v3@alpha.7 Released - Users & Permissions plugin

http://ift.tt/2Cx3Icg

Submitted December 18, 2017 at 12:50PM by pierreburgy

Node.js VS PHP? Which one should you pick?

http://ift.tt/2jbJi0O

Submitted December 18, 2017 at 12:38PM by him_tyagi

All You Need To Know About Parcel πŸš€

http://ift.tt/2yNu1bM

Submitted December 18, 2017 at 12:41PM by thickoat

How to check multiple inequality for data taken with http-request ?

I have program in node.js that send POST request to server and gets a price value every few seconds . I want to track the value for multiple users with each their own limit for price that if passed need to be notified. My question is how can I do that since you can't return from asynchronous function ? ( Or am I approaching this the wrong way?)The way it works now is I call the functionvar cloop = setInterval( function() { getValue(limit); }, 3000); where the limit is the limit user wants but it would be redundant to call it multiple times for each user. getValue is the function with POST request inside it and the limit is checked in the callback function.Thank you

Submitted December 18, 2017 at 10:41AM by afghanmeysi

What are best practices Windows server deployment techniques for NodeJS?

To set the scene, I work in a Microsoft 'enabled' business, with an application base ranging ~2-15 years behind current Microsoft technology (depending on which area of the business you are in). Some parts are 365 / Azure ... and some have the year 2005 in their build title :-/ (could be worse).For a small integration project I decided to use NodeJS instead of Powershell with the initial goal of prototyping and to facilitate deeper learning of NodeJS.The app.js logs into some websites, scrapes some data and downloads some CSV and XLS files, splits the datasets, performs some comparisons / validation on a MSSQL database for eventual loading to another database. A few things going on but not too brain busting (standard enterprise script jibber jabber). The web scraping part annoyingly has to exist due to lack of an API and no plan by the 3rd party to ever implement one!As the prototype evolved it became apparent that the application was going to end up being quite succinct due to the NodeJS packages I am using, providing bang for your buck functionality (even more succinct than what I could do in Powershell ... but spread out over a shitload more modules / files!).Due to my application being so incredibly cool, I have decided not to re-write the application in Powershell, rather directly deploy it as the Production application (support will not be a big deal for this application).I have pre-production running as a windows scheduled task executing 'babel-node app.js' out of my 'dist' directory (environment vars set to production also) but I am curious at how people would deploy this application in the wild? Is there a more acceptable / less bastardized approach than what I am currently doing here? Assume NodeJS versions installed and managed already, docker not an option in this scenario, databases are local (not Azure) thus application requires local hosting to function best.(*PowerShell overrides SSIS for me but that is a story for another day ... and our SSIS server is provisioned for heavier events thus this small applications CPU cycles can be somewhere other than there)

Submitted December 18, 2017 at 10:59AM by Faux_Real

Module 'btford.socket-io' is not available!

let groupModule = angular.module('app.group',['btford.socket-io']);I have included socket.js and /http://ift.tt/1aeIZU4 as well. Still getting this error. Completed all the steps in ReadMe but still getting this error:-Github repoI am trying to use angular-socket-io.

Submitted December 18, 2017 at 09:44AM by datavinci

AngularJS packages similar to angular-socket-io?

Should be easy to use and well documented.

Submitted December 18, 2017 at 09:46AM by datavinci

In my Express+AngularJS chat app, what to do about /http://ift.tt/1aeIZU4?

I am developing a chat app in expressjs+ AngularJS. I read in different tutorials that we have to include /http://ift.tt/1aeIZU4 in client html file. But I have my AngularJS code in different directory and also the port number for localhost is different. So what to do? Where to put it ?

Submitted December 18, 2017 at 07:37AM by datavinci

Sunday, 17 December 2017

Node won't install on a Mac OSX using 'brew install node' with homebrew

Upon using 'brew install node' the terminal responds with "Error: Could not create /usr/local/Cellar Check you have permission to write to /usr/local"

Submitted December 18, 2017 at 05:01AM by mhamer87

Node.js Best Practices - How to become a better Node.js developer in 2018

http://ift.tt/2ANv3WY

Submitted December 18, 2017 at 03:08AM by gorgerson

Can't get Ionic to install properly. Completely new at mobile development, appreciate any and all help!

http://ift.tt/2AKjwYF

Submitted December 17, 2017 at 08:28PM by typicalstudentirl

REST is the new SOAP – Pakal De Bonchamp

http://ift.tt/2yEYtEY

Submitted December 17, 2017 at 05:09PM by ratancs

How to remove #! getting added to url in my AngularJS application?

I have tried:- $locationProvider.html5Mode(true).hashPrefix('!'); and adding but to no avail. When I navigate to a particular url, #! disappears but when I tried to reload, it gives the error:- Cannot GET.So I looked online, and found out that doing above is only half of the solution. We also need to rewrite the logic on server side as well. So I am using NodeJS and browserSync package to fire up localhost. So what is the solutioin to this?Note:- My backend and frontend code are separate and both handle routing.

Submitted December 17, 2017 at 05:13PM by datavinci

Yet another Active Record-like ORM for Node.js

http://ift.tt/2CMJKey

Submitted December 17, 2017 at 04:28PM by dotnil

node js - unit test issues

http://ift.tt/2CBk6Jx

Submitted December 17, 2017 at 03:00PM by pekithedog

npm error: TypeError('Path must be a string. Received ' + inspect(path));\n

How a simple legibility change to ECMAScript spec can violated parser's LR(1) lookup

http://ift.tt/2zYBl6r

Submitted December 17, 2017 at 10:54AM by fagnerbrack

There are now over 600,000 packages in the npm registry

https://mobile.twitter.com/seldo/status/937757823601016833

Submitted December 17, 2017 at 10:59AM by fagnerbrack

Saturday, 16 December 2017

How can I allow users to vote without signing in?

Hi,I'm teaching myself how to use node, and would appreciate some advice on an app I'm working on.I'm making a very simple webpage which is essentially a list of links ordered by how many upvotes they've received. Similar to reddit, but the links won't expire and disappear over time. I'm planning on storing each link as a db object with mongo, and I want to allow users to upvote/downvote each link without being signed in.Any ideas on the best way to tackle this so that users can't vote more than once even without authentication?Thank you!edit: btw the site won't allow you to sign in at all, all anonymous voting

Submitted December 17, 2017 at 03:30AM by notnotgoodbad

Best Practice for Recursively Invoking the Package Manager While Running Scripts?

Inside my package.json I'm trying to call the lint script I have inside my test script before I run Jasmine. I personally use Yarn but in the unlikely event of someone else doing dev work on this package I didn't want to hardcode yarn run lint && jasmine in case that's not installed on their system. Since I was curious I figured I'd make a script that when invoked simply echoed out the contents of process.env to see if I could use anything from there. I ended up with two candidates for usage npm_execpath: '/usr/local/lib/node_modules/yarn/bin/yarn.js' and _: '/usr/local/bin/yarn'. I'm leaning toward using the later to invoke my script (e.g. $_ run lint && jasmine). But I was curious if that env var is not guaranteed to always be the package manager binary, there could be cross-platform compatibility issues, or if there was simply a better way of accomplishing this task.

Submitted December 17, 2017 at 01:24AM by jbenner

books on nodeJS for beginners-itermediate

im looking to but some books for on nodeJS the books should contain information about express and a database preferablly mongoDB/mongoose do you know any books for this??

Submitted December 16, 2017 at 08:48PM by Sean_Carroll

How to return multiple array from expressjs routes?

Currently I have the following statement for return an array from a get route:-return res.json(dataChunk); Now I also have another array results[1] which I also want to return. So how to do it?

Submitted December 16, 2017 at 06:26PM by datavinci

Should I use a front-end framework?

Hi!I'm new to web development, I did some front-end projects and did some back-end with symfony. I want to know when it's better to use a back-end server and another front-end server with some js framework. I mean, for example i'm doing a web project with nodeJs, is it better if I only use nodeJS with a view engine (like jade or something), or I use nodeJs just as a web Service with some js framework for the front (since i'm more used to it) ? Thank you.

Submitted December 16, 2017 at 04:28PM by nwoob

How To Create A Bitcoin Text Alert Service With NodeJS | Feedback Appreciated!

https://www.youtube.com/watch?v=U3ow9w0-piI

Submitted December 16, 2017 at 12:13PM by jfishersolutions

Problem with twitter API

I'm using nodejs to build a twitter bot, everything works fine but I can't find information on a particular API, the one to return informations about a specific tweet. I'm using:loadTwit = function(value){ T.get('statuses/show/:id', { id:value }, function (err, data, response) { console.log(data); }) But it return me page not found. I guess the request is incorrect, but I can't find any documentation. Can you help me? Thanks

Submitted December 16, 2017 at 12:35PM by snakethesniper

Friday, 15 December 2017

Is it bad form to use Promise catch() for operational conditions?

I inherited some code that uses Promise reject()/.catch() blocks for records not found in a database. These conditions are not "errors" per se, but are fully expected within the operation of the app.Is this correct form?I've always thought that a promise catch should be for unexpected errors and that a record not found condition should be dealt with in the resolve()/.then() blocks.Thanks!

Submitted December 16, 2017 at 04:30AM by 64bitHustler

How to keep running code with nodejs even when nobdy is visiting site?

So basically I have some logic that I need running in the background 24/7 not only when someone is visiting my site. Can anyone recommend some package or something else?Thanks in advance

Submitted December 15, 2017 at 11:05PM by hyopwnz

Implementing JavaScript Functors and Monads

http://ift.tt/2AowM8J

Submitted December 15, 2017 at 08:58PM by fagnerbrack

Introducing RESTyped: End-to-end typing for REST APIs with TypeScript

http://ift.tt/2ChNljn

Submitted December 15, 2017 at 07:35PM by rawrmaan

Node.js Weekly Update - December 15

http://ift.tt/2kxohhh

Submitted December 15, 2017 at 04:09PM by andreapapp

An interview about testing in JS with Kent C. Dodds, Justin Searls, and the guys from Cypress.io

http://ift.tt/2ACmgap

Submitted December 15, 2017 at 04:24PM by pauldowman

Visualise DataLoader (Requires >1024px device) - An Interactive Tutorial to Facebook's Caching/Batching Utility Library

http://ift.tt/2ARmWNl

Submitted December 15, 2017 at 03:27PM by awebofbrown

Just released PlotlyChartExport. An npm module that exports Plot.ly charts on the server.

http://ift.tt/2AvYexu

Submitted December 15, 2017 at 10:27AM by mbejda

Free eBook: Node.js 6.x Blueprints [PDF,ePub,Mobi and DRM free]

http://ift.tt/2jX6CzW

Submitted December 15, 2017 at 09:31AM by PacktStaff

Thursday, 14 December 2017

Vaxic - the powerful, light Node.js web framework

http://ift.tt/2i5A3lB

Submitted December 15, 2017 at 02:48AM by Etha_n

Scaffold REST APIs with Typescript, Express, and Swagger - Features automatic request validation and interactive api doc

http://ift.tt/2o8AuxV

Submitted December 15, 2017 at 12:53AM by coracarm

mysql

Anyone have an api built on top of mysql with an async/await implementation they are happy with? Been banging my head on this today

Submitted December 14, 2017 at 10:47PM by vv1z

rapidjson-writable - An API to rapidjson that supports writing data asynchronously.

http://ift.tt/2ClRuUy

Submitted December 14, 2017 at 08:31PM by _bit

Who's coming to Assert(js) Conf in Feb?

http://ift.tt/2ysISZ5

Submitted December 14, 2017 at 04:37PM by ukrainiankolbasa

Why (and how) to use ESLint in your project

http://ift.tt/2j1We9P

Submitted December 14, 2017 at 04:34PM by grajagandev

How we secure real-time applications with JSON Web Tokens

http://ift.tt/2zc0lZm

Submitted December 14, 2017 at 03:16PM by Emielean

Signing then immediately verifying JWT token throws "Invalid signature"

Hello boys and girls,I'm trying to use node-jwt to provide auth on my (embedded) webapp. Here's the problematic piece of code :function generateToken (ipAddr){ var token = jwt.sign(ipAddr,"mysupersecret"); jwt.verify(token, "mysupersecret", function(err, decoded) { console.log(err); console.log(decoded); }); return token; } Calling generateToken (ipAddr is defined BTW) will raise a "Invalid signature" error, which really puzzles me. Important piece of information : this worked yesterday, with strictly the same code. I'm guessing a lower layer is causing the problem, but a day of seaching left me with no answer. Does someone have any ideas ?Have a good day :-)

Submitted December 14, 2017 at 02:30PM by mickev

Chevrotain - Parser Building Toolkit for JavaScript

http://ift.tt/21VEsU7

Submitted December 14, 2017 at 02:42PM by bidi82

How to test your Node.js app against multiple versions of Node?

http://ift.tt/2jRNV0M

Submitted December 14, 2017 at 10:04AM by PavanBelagatti

Opinions on "natural" for NLP

I am trying to classify and analyse some open ended questionnaire data for a Market Research company and came across "natural" as a means to do so. It seems like a pretty simple to use package from which I can build a classification model and then maybe do some further analysis.How does it compare to paid options like the Watson NLC or other packages out there?

Submitted December 14, 2017 at 06:12AM by DrClocktopus

Wednesday, 13 December 2017

So what's the status on import with ES6 module system?

When I last researched this, "requiring" CommonJS modules was still the standard. Has things changed now?Side question: Is it possible/recommended to use require on ES6 modules? What about import on CommonJS modules?

Submitted December 14, 2017 at 03:35AM by g-o-dude

Alternatives to forever?

Are there any alternatives for just a simple restartimg the app if it exits, nodemon does not work in that scenario. Forever has a few issues and it looks like it's not being developed anymore.

Submitted December 13, 2017 at 11:17PM by bengtc

Beginners question about using promise (error handling)

I am using knex in my first node app. Knex return a promise. I try to understand how to handle my errors. I think I have looked at too many videos and read too many articles that have not quite related to my project which has got me a bit overwhelmed and confused.Say we have this very basic code that get comments from my db.router.get('/comments', (req, res) => { queries.comments() .then(comments => { res.render('comments', ({ comments: comments })) .catch(err => console.error('Error getting comments', err)) }); }); Would this be a basic but correct way catching the error from the query? If there would be an error what would the argument err be, that confuses me and I am not sure how to test it easily? Where does it come from. Would it return something like "No records found" or similar?Would appreciate to if someone could point out the obvious =)

Submitted December 13, 2017 at 08:44PM by geoholic

JavaScript native V8 code coverage

http://ift.tt/2CaUweh

Submitted December 13, 2017 at 10:33PM by grajagandev

Need Help with Node Module Mismatches

suddenly got this wierd error "Error: Cannot find module './decimal128'"

Live WebAssembly AMA tomorrow. Ask about Node.js!

http://ift.tt/2ygassn

Submitted December 13, 2017 at 07:05PM by Psaulitis

VS Code: Showcasing The Power of Real Time Collaboration

https://www.youtube.com/watch?v=BoHuTm--D0E

Submitted December 13, 2017 at 03:45PM by bidi82

Help, I'm struggling to package my app.

I keep getting "use 'esversion: 6'" errors - how to make it stop?

So I have the latest version of NPM (5.5.1) and keep getting ES6 warnings. Example - using "const" [jshint] 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). (W104) Isn't ES6 standard now?

Submitted December 13, 2017 at 02:24PM by HuckleberryC

Server-side I/O Performance: Node vs. PHP vs. Java vs. Go

http://ift.tt/2r3pLRO

Submitted December 13, 2017 at 01:23PM by speckz

Tuesday, 12 December 2017

Socket.io - RAM vs CPU for VPS?

Im looking to set up a node server with socket.io, I'm wondering what is more important to have in a VPS, Ram or CPU power. I want to be able to support as many requests as possible.With the many providers, packages vary and some provide more CPU for the $ while others provide more RAM for the $.How much of a factor is RAM in a heavy lifting nodejs application?does more RAM mean more connections with socket.io? Do I care about more cores > more ram.. or more ram > more coresThanks! any help would be appreciated.

Submitted December 13, 2017 at 02:49AM by bbloodsw21

Weird setTimeout() bug for multiple processes, Ctrl+C magically restores code execution.

I have a bunch of different nodejs apps (or processes) that I run on the same machine. Some of those use setTimeout() to delay code execution (I'm retrieving stuff from an online server). When I run a single nodejs app (with "node myapp.js") everything runs fine. If I run 2 or more (with "node myapp.js" and "node anotherapp.js") somehow they bot get stuck.The callback used on setTimeout() is not called anymore (I think because I've logged it and that's the point in code where it stops). The really weird thing is that I can unstuck it by going to the powershell window where I've initiall started my nodejs app and press Ctrl + C - which should kill the app completely but it doesn't - it magically continues the code execution. This doesn't happen all the time though and so it's hard to debug it. I'm thinking maybe node loses track of the timeout variables - I'm not using any by the way, that is I call setTimeout() directly and not asigning it to a var.Any thoughts or sugestions are welcome. Thanks!

Submitted December 12, 2017 at 08:34PM by odonian_dream

Node v9.3.0 (Current)

http://ift.tt/2yjfBzW

Submitted December 12, 2017 at 10:16PM by dwaxe

NPM-Scripts - View and run your package.json scripts from the sidebar

http://ift.tt/2BhERw2

Submitted December 12, 2017 at 10:44PM by Duroktar

The Current State of Implementation and Planning for ESModules

http://ift.tt/2z3Yohy

Submitted December 12, 2017 at 07:14PM by _bit

Consumer Driven Contract Testing with Pact

http://ift.tt/2jT2HUN

Submitted December 12, 2017 at 06:47PM by andreapapp

Any thoughts on TypeORM vs. Sequelize?

Thus far have used sequelize on all Node projects ... TypeORM looks very interesting. I'm curious if anyone has made the switch, and if so, how they feel about it? Thinking about trying this in my next project!

Submitted December 12, 2017 at 03:51PM by djslakor

Ironode template -> Social login added

http://ift.tt/2AEvUfY

Submitted December 12, 2017 at 02:00PM by victor-wayward

Socknet Advanced realtime library for people who need more !

http://ift.tt/2z3ugmz

Submitted December 12, 2017 at 12:50PM by leonev

Nextein starter kit to create your blog/site with React & Markdown

http://ift.tt/2AchEHL

Submitted December 12, 2017 at 12:40PM by elmasse

WebAssembly Server side rendering with C++ - asm-dom@0.4.0

http://ift.tt/2l341ba

Submitted December 12, 2017 at 12:24PM by Teo_Basso

10 Reasons that Make Node.js a Top Choice for Web Application Development

http://ift.tt/2iSIAFi

Submitted December 12, 2017 at 09:53AM by AlfredEkka

Help, Having trouble with nat-upnp

[code] if (err) throw err; ^ Error: timeout [/code]Thrown in: [code] client.getMappings(function(err, results) { if (err) throw err; }); [/code]The lib i'm using: http://ift.tt/1b1RPg7

Submitted December 12, 2017 at 08:04AM by Bar771

Monday, 11 December 2017

Does someone knows any offshore/anonymous node hosting?

I have a node server running on a raspberry pi clone. Now I wanted to add cryptocurrency support to the website and looked for legal advice on the Internet. I found out that a lot of small websites are being shut down and their owners are being fined for integrating cryptocurrency. Some of them had just a donation/tip button but that breaks crowfunding laws of my country (donations/tips are considered a form of crowfund here).I need a hosting company that doesn't need personal info and that doesn't cost a ton of money. Most of the offshore hosts I found cost 40$+/month, some of them include things I don't need like gambling licenses, databases and a lot of services.I just need a very basic server with at least 1Gb RAM (it currently uses ~500Mb) and 1.5-3GB storage.

Submitted December 11, 2017 at 08:13PM by Kran6a

Does node.js call home to google?

from http://ift.tt/2AKxJoZ Chromium is obviously safe as it has a huge developer team behind it and vulnerabilities are solved rather quickly. As for privacy... You will not be avoiding Google. No matter your browsing habits (i.e. not accessing any Google services). Even Chromium phones home with Google and there is no way to completely prevent Google from identifying you as long as you're using a Chromium-based browser (doesn't matter if it's Chrome, Chromium or off-shoots like Iron). Analyses of network traffic clearly show that they all contact Google. The data being sent is encrypted, we do not fully know what it is. In the great scheme of things, prediction, pre-fetching, etc. don't make a lot of difference. Whenever you're browsing with Chromium, you ought to assume that whatever data you entered, whatever website you attempted to visit or visited, it can be directly linked to you. You will not get privacy with Chromium.

Submitted December 11, 2017 at 08:32PM by guywithacomputer401

Noob looking for Request login help

I'm trying to scrape a website that requires login first. All of the tutorials on the internet seem to deal with non-login sites. The site that I'm trying to scrape is ourgroceries.com, which has a login form. So I have two questions:How do I login to the site using request?Once I've logged in, how do I request other pages while retaining the logged in status?Thanks in advance for any help you can provide.

Submitted December 11, 2017 at 08:02PM by Willy_Wallace

How to write to a file with streams on infinite loop ?

Hi there.Is it possible to write to a file with streams when looping through infitiny ?Can i make this kind of code work with Node.js?let ws=require("fs").createWriteStream("dat.out",{flags:"w"}); for(;;){ let str=Array.from({length:10},(v,i)=>String.fromCharCode(65+ ~~(Math.random()*25))).join(""); ws.write(str); } I can make this with setInterval(fn,0) (fn is the function code inside for(;;) loop ) but it is not as fast as infinite for loop .Thanks .

Submitted December 11, 2017 at 08:08PM by vasifsiz

need guidance creating nodejs apps in php/mysql framework with later on full step by step migration to nodejs in mind

I'm looking for the most efficient path to convert over time my own made php framework for nodejsCONTEXTI'm working on a project that requires real time functionalities for which node/socket.io appear to be the most efficient solution.CONSTRAINTSI've built my own php/mysql OOP framework to manage projects over the years with some very nice functionalities for web content managers and nice functionalities for me to radically simplify specific development (based on my own personal logic obv.) and manage all my projects in just one instance of my framework.There is no way I can rewrite all this for node just now.I have to keep taking advantages of my framework & back-office tools to work fast while developing my first node apps.after this new project is in production, i will start to rewrite for nodejs the functionalities server side & client side; one at a time (keeping my local dev environment & all my project in prod always in sync).QUESTIONHow do I start introducing nodejs to my framework ? so that-I won't spend too much time on it now (except for the node apps I need obviously)-I won't have too many headaches when I start replacing php and the old js to take advantage of node-php/mysql & js/mongodb should nicely cohabit on the servers until there is no more php in the frameworkmy framework logic - abstracted without all the details :http://ift.tt/2jx5uq3 follows is where i'm at, possible solution I've identified & am considering, but there may be other ways I'm not aware of yet ?Should I better be :for my first node apps : using a proxy like Nginx to have node & apache, mysql & mongodb side by side ? or is it worth investing the time now to have my php engine working with node, using modules for php, sql ? another path ?writing the node apps with mongodb as db server & when necessary exchange values from sql to the app using php ? or is it worth investing right now the time to move from mysql to mongodb the full framework rather than after one tool/functionality at a time ? another path ?convertingfrom top to bottom (ie starting by replacing the http request handler & have js passing the ball to php for the rest and so on, would I be able to do that ?)from bottom to top (ie the plugins, the backoffice tools, then templates, then rendering engine...) ?(don't tell me i have to do all at once please !)thanks a tun for sharing your knowledge, those first decisions are really critical and will affect so many hours of work.

Submitted December 11, 2017 at 04:17PM by mknsh

A question about node and pm2 cluster mode

Hello guysI have a node app that's starting to get pretty popular. I need to upgrade to a Digital Ocean Droplet (=VPS) with 4 CPUs.In order to run one instance of the node app on each CPU, I'm going to use Pm2 with cluster mode.Now, I have two questions :1) My app has a method called every 5 minutes that call an external API and update the database. If I run 4 instances of the app with PM2 cluster, will every instance call this API and update the db ?2) I want only one app to run this external API call +db update, not the 4 of them, how can I handle this ?Thanks guys

Submitted December 11, 2017 at 02:52PM by OogieFrenchieBoogie

How to really take advantage of the NodeJS REPL

http://ift.tt/2iTh9LR

Submitted December 11, 2017 at 01:05PM by Gonzaesc

Architecture for multiplatform native development in Kotlin with React, Android, Wear, desktop and soon iOS example.

http://ift.tt/2yeFXTC

Submitted December 11, 2017 at 01:18PM by MadProgrammer2058

How To Contribute to ECMAScript spec

http://ift.tt/2hH98MU

Submitted December 11, 2017 at 11:09AM by fagnerbrack

Objection and Apis

So, I'm getting use to objection+knex and I gotta say that after an initial phase where I had to bootstrap and understand the mechanisms and how it works, it seems very nice, and I want to go deeper.I have a model Person that describes a person with a first_name, last_name and a *bio. I have created from scratch the basic CRUD methods to operate on the Person model, using the knex and objection additional methods (like findById).But, at this point I would like to try 2 different thigs:Is it necessary to create these APIs from scratch? Can I automate the process? I have found that there are an objection-rest and objection-graphql modules that maybe suit my needs. Has anyone tried them? Do they work?How do I implement search? For instance, I want to retrive instances of Person with the first_name 'John', or even better, partial text matching?JSON-API. Even though the specitfication seems great, I still haven't understood how I can implement it.I am using postgres, express and knex+objection.

Submitted December 11, 2017 at 09:44AM by honestserpent

Sunday, 10 December 2017

Why Choose Node.js for Server Side Programming

http://ift.tt/2ydyft1

Submitted December 11, 2017 at 05:30AM by EllaNicholls

I really need help.

I hired a developer to build a custom web application. They suggested using a MEAN stack and they would develop a custom blog that will integrate into the app.Now they want to use Wordpress for the blog and the rest of the application will be using the MEAN stack.Am I getting ripped off?Could this work?How well does Wordpress integrate with a node application?Thank you!

Submitted December 11, 2017 at 12:23AM by ineedhelpcoding

How I built my latest NodeJS CLI app using TypeScript and fs.createReadStream

http://ift.tt/2B5038u

Submitted December 10, 2017 at 06:34PM by jkomyno

How I cut my Heroku cost by 400% | REPOST /Programming

http://ift.tt/2iMqGEq

Submitted December 10, 2017 at 08:17AM by kasra85

Saturday, 9 December 2017

awesome-awesome-nodejs: A Collection of Awesome Lists Related to Node.js

http://ift.tt/2B4diWH

Submitted December 10, 2017 at 03:48AM by _bit

Why we have banned default exports in Javascript and you should do the same

http://ift.tt/2ztVnbZ

Submitted December 10, 2017 at 01:08AM by fagnerbrack

Creating sub users using passport

I am trying to make an application (well modify what I have already) that will allow people to sign up to my site, then that is the admin login with the option to create separate logins for sub users /their clients. The idea is that they will be able to assign functionality to the sub users for example, create new items or checkout items ect.I am currently using passport-local and would like to stay with it so I don't need to do a complete rebuild. I am thinking of using ldap in some way. Does this make sense or is there a better way?Also if I use LDAP how would I structure it best?

Submitted December 09, 2017 at 09:23PM by jsdfkljdsafdsu980p

Accelerating the Development of Node.js Using OpenShift - DZone Web Dev

http://ift.tt/2AnEQH7

Submitted December 09, 2017 at 06:25PM by pmz

Node.JS Top 10 (Dec 2017)

http://ift.tt/2A5Xejv

Submitted December 09, 2017 at 04:55PM by Rajnishro

opeNode.io experience

I just find out that I could deploy mine node.js projects on openode.io for free for testing. Does anyone have experience with them, they seem very affordable for some small websites.Is there any catch or I could really get unlimited up time for $0.18.

Submitted December 09, 2017 at 03:13PM by crveniOrao

How would I push new data to a web app after receiving an update.

Me again with my newbie questions.So I have some stuff that pulls data from another sites API and I think I have that part worked out. But the data shows up after the page is first rendered. How would I go about pushing that data after it is received and update the page/app?Again im looking for basic concepts or tutorials as to what the methods are for doing this so I can look into it more, not code specifics.Thanks in advance.

Submitted December 09, 2017 at 03:05PM by wobmonsta

Master the command line, in one page

http://ift.tt/1IV1NNB

Submitted December 09, 2017 at 01:45PM by ratancs

A useful list of must-watch talks about JavaScript

http://ift.tt/1z4igc0

Submitted December 09, 2017 at 01:14PM by ratancs

A simple and composable way to validate data in Javascript.

http://ift.tt/2in7Zui

Submitted December 09, 2017 at 01:15PM by ratancs

Help with unit test, I can not make it work

I am creating a unit test, this test consists of using the twitter API to obtain data of any profile (Name, number of tweets, followers, date of registration, etc). The point is that I'm using the Mocha library for this task, but I run into the problem, that when executing the assert, the twitter request takes more than 2 seconds (Mocha's default timeout), therefore my test always fails. Could someone give me a hand? What should I do, so that the comparison of the assert is executed after receiving all the data of the request to twitter?The repository where I have uploaded the code is the following: http://ift.tt/2ySPRy0

Submitted December 09, 2017 at 11:44AM by MagoMerlin

Node bind.toFile

So i've made this node server where i call the bind.toFile('./mypage.html, ...) function to open mypage.html, I would like this page to have a static image (stored locally) in it. I tried linking the image like this:not foundBut it doesn't see to work. Help i'm desperate :(

Submitted December 09, 2017 at 10:33AM by LucaBazza

Friday, 8 December 2017

Why should I use node for Angular?

I’ve created a web app with a Spring-Boot/Java backend and an Angular5/Node front end.My coworker is giving me shit saying I should just install the required angular files and put them into our project. Can the Node community please give me some support and logic as to why I need to use Node? Fucking java junkies..

Submitted December 09, 2017 at 05:47AM by csiegmundt

SuchTube - YouTube search as a service, with Slack integration and CLI

http://ift.tt/2iI7Jmc

Submitted December 08, 2017 at 08:18PM by markets86

NodeJs Example of Scripting Linux command line calls

http://ift.tt/2BZQkxS

Submitted December 08, 2017 at 04:26PM by funofjs

Node v4.8.7 (Maintenance)

http://ift.tt/2BZQnty

Submitted December 08, 2017 at 04:33PM by dwaxe

Node v6.12.2 (LTS)

http://ift.tt/2BZQpla

Submitted December 08, 2017 at 04:33PM by dwaxe

Node v8.9.3 (LTS)

http://ift.tt/2BZQsgQ

Submitted December 08, 2017 at 04:33PM by dwaxe

Node v9.2.1 (Current)

http://ift.tt/2C03tHh

Submitted December 08, 2017 at 04:33PM by dwaxe

Getting this error while running the Express.js app on Node

Node.js Weekly Update - December 8

http://ift.tt/2A5oVJj

Submitted December 08, 2017 at 03:35PM by andreapapp

Tips/advice/opinions on deploying Node/Express app with React front-end?

I've been working with Express and React locally a bit and I have a few projects, but keep falling short of deploying them because I have a bad habit of wanting to fully understand something before diving in. After some research, it seems like are a few ways to deploys Express apps with a React front-end***: 1) Keeping the two together and deploying somewhere like DigitalOcean VPS 2) Keeping the two separate and hosting on two different services, such as SW3 and DigitalOcean VPS 3) Using a proxyWhat do you think is the best approach? What advice would you have for your preferred approach?***giving credit to Dave Cedia for the article http://ift.tt/2th74LU

Submitted December 08, 2017 at 01:45PM by __Taco

Node machine learning for text/spam filtering

HeyI have a bunch of data (text based messages) where some of them are legitimate and some are not. I want to train the app to recognise the difference. Is there a way to do this already out there? Do I want machine learning / neural networks. If so, where do I begin?

Submitted December 08, 2017 at 11:52AM by Fletch-Sorensen

Can someone help me with uploading the image on aws server

http://ift.tt/2B09hmi

Submitted December 08, 2017 at 12:12PM by Ankur_3

Invoicing app with customizable templates. Designed for freelancers [Freemium]

https://manta.life

Submitted December 08, 2017 at 09:03AM by lequochung

Invoicing app for freelancers [Freebie]

http://ift.tt/2nErTmo

Submitted December 08, 2017 at 08:45AM by lequochung

Thursday, 7 December 2017

Node.js meets OpenCV’s Deep Neural Networks — Fun with Tensorflow and Caffe

http://ift.tt/2BdR5Gq

Submitted December 07, 2017 at 08:50PM by justadudewhohacks

miru - dev server for bundlers or static files~

http://ift.tt/2iBprKe

Submitted December 07, 2017 at 09:16PM by talmobi

How do you handle logging?

At my company, we're in a bit of a state with regards to logging. All that happens at the moment is console.log, with the occasional console.error. We have Winston installed, but I ended up setting that to { level: 'error' } to quieten down logs slowing down prod. They go into Graylog at the moment, but nothing too advanced.I have never really got my head around proper approaches to logging in nodejs. I have looked at the debug library, but I feel like we should be using something more advanced. The service have winston, should I be logging using a winston logger?What's your own approach?

Submitted December 07, 2017 at 04:39PM by nearxanldn

How can I print ASCII art on the next to other output?

Basically I want to recreate Neofetch as sort of a pet project. I have figured out how to get some of the relevant OS information (the text on the right of this image) but I don't know how to get properly aligned ASCII art on the left of that text block.Any help would be much appreciated! This is my code so far if anyone is interested. http://ift.tt/2j3Kir9

Submitted December 07, 2017 at 04:49PM by alfredmuffin

Monitoring the performance of a Node.js web application - Sqreen Blog

http://ift.tt/2jMrcpH

Submitted December 07, 2017 at 04:57PM by pmz

Objection.js, validation and sanification

Hi, I am trying Objection.js and I love it. Until now, while testing the module, I have performed object validation as in the example, through JSON-schema.Assume I have this:class Person extends Model { static get jsonSchema() { return { type: 'object', required: ['firstName', 'lastName'], properties: { id: {type: 'integer'}, parentId: {type: ['integer', 'null']}, firstName: {type: 'string', minLength: 1, maxLength: 20}, lastName: {type: 'string', minLength: 1, maxLength: 20}, age: {type: 'number'}, address: { type: 'object', properties: { street: {type: 'string'}, city: {type: 'string'}, zipCode: {type: 'string'} } } } }; } } This works, but I have a few doubts.I do not understand if it is possible to specify custom error messages. For instance, maybe I would like to have "first name length must be between 1 and 20" as the error message sent out when the length is wrong.I know it is possible, but I have not understood how to change the validator with a custom one (I would like to try Joi). Maybe someone has an example somewhere?

Submitted December 07, 2017 at 02:52PM by honestserpent

Introducing terminus: Health Checks and Graceful Shutdown for Node.js Applications

http://ift.tt/2kvCJtC

Submitted December 07, 2017 at 12:38PM by gorgerson

Dynamic import()

http://ift.tt/2hGRvcz

Submitted December 07, 2017 at 11:57AM by fagnerbrack

Npm 5.5 shrinkwrap vs packaging node_modules to production

First, I know this question has been asked many many times before, but all those questions goes back to 2014, 2015 or before.My question, with npm 5.x and specifically 5.5.x, where it enhances its algorithm in getting dependencies, isn't depending on npm_shrinkwrap is enough to give you an exact node_modules tree in production, to what you have in dev/test?At my work , we are debating between packaging node_modules in the production push, or depend on npm install --production.We are using the latest npm version: 5.5.1

Submitted December 07, 2017 at 11:15AM by gkarwchan

Wednesday, 6 December 2017

Wooster - Quick Errors~

http://ift.tt/2BHaHyR

Submitted December 07, 2017 at 01:49AM by talmobi

Global gitignore node_modules?

A student asked me this today and I was pretty stumped: If we have a ~/.gitignore_global file, for example to ignore a Mac's .DS_Store files, then why don't we globally ignore node_modules?Or, put another way, in what situation am I going to want to track changes in node_modules, that means I shouldn't ignore it globally?

Submitted December 06, 2017 at 11:14PM by Earhacker

geojson-lookup - ⚡️ Fast geometry in geometry lookup for large GeoJSONs.

http://ift.tt/2iuha8D

Submitted December 06, 2017 at 10:22PM by simonepri

What is a good methodology for retrieving someone else's data/json from their API?

So im a bit of a newbie to node/ coding in general and looking to get data from an external API then make use of the json (store it in a database).What I need help with is an example of retrieving json data from a web site. I have found tutorials on building an API but not fetching the data from it. I think I know enough about the DB portion and the tutorials seem to have enough info on DB.Im mostly looking for a direction to run with as in a tutorial or blog post or even the correct terminology to search. I feel like im not looking up the right thing so im not finding the correct help.Anyways, thanks in advance.

Submitted December 06, 2017 at 10:33PM by wobmonsta

Node 9.x.x still incompatible with npm and, to a lesser extent, yarn

Why is there so much silence regarding the still unresolved incompatibility between Node 9.x.x and npm? I don't see any articles or posts about it and my questions on node/irc received no response. I haven't seen npm and yarn break like this with any release of Node.js to date. Node is pretty useless if I depend on npm start to get the thing going and npm just barfs incompatibility errors. Why was it ever released in this state?

Submitted December 06, 2017 at 10:04PM by lordmyd

Aerospike Query Language Command Line Utility (xpost at r/database)

Hi, I am new to nodejs and opensource but as a startup project I tried to make a command line utility to query aerospike. I tried to make a basic application using nodejs aql client and give user options like get, post,alter etc commands to query aerospike. User can also see output in form of json or tables. I would appreciate some feedback on it and things that i should improve upon from a user's point of view. Also, I have recently started to make it using a REPL sever of node js as to run all queries over a single session. Github Link

Submitted December 06, 2017 at 06:46PM by lavaAD

Announcing N|Solid 3.0

http://ift.tt/2nA2gmA

Submitted December 06, 2017 at 05:01PM by _bit

Help With Wes Bos Learn Node Course

I'm working on Wes Bos Learn Node course and I'm having a problem with the Google Autocomplete section. I was receiving an error because of my Google API key but now that I fixed that I havent received any errors. Just the dropdown function wont autocomplete the City. http://ift.tt/2AUm1e1 is my code below..function autocomplete(input, latInput, lngInput) { if(!input) return; // skip this function from running if there is no input on the page const dropdown = new google.maps.places.Autocomplete(input); dropdown.addListener('place_changed', () => { const place = dropdown.getPlace(); latInput.value = place.geometry.location.lat(); lngInput.value = place.geometry.location.lng(); }); // if someone hits enter on the address field, don't submit the form input.on('keydown', (e) => { if(e.keyCode === 13) e.preventDefault(); }); } export default autocomplete;

Submitted December 06, 2017 at 02:10PM by Simbaxo

Objection.js and timestamps

I have just started using objection.js and I love it!However, I have a problem with timestamps. It is not about how to create them. I followed the docs and looked up examples and they are setup properly.The problem is that I want those fields to be set only by the db, and from none else.Instead, after the setup I did, I doPeople.query().insert({updated_at: '2017-01-01'}); I am able to explicitly set the value. Is there a way to avoid this?My people.js model file:const Model = require('objection').Model; class People extends Model { // Table name is the only required property. static get tableName() { return 'people'; } $beforeInsert() { this.created_at = new Date().toISOString(); } $beforeUpdate() { this.updated_at = new Date().toISOString(); } static get jsonSchema() { return { type: 'object', required: ['first_name', 'last_name'], properties: { id: { type: 'integer' }, first_name: { type: 'string', minLength: 1, maxLength: 255 }, last_name: { type: 'string', minLength: 1, maxLength: 255 }, bio: { type: 'string' } } } }; } module.exports = People; and my migration file for the people table:exports.up = function (knex, Promise) { return knex.schema .createTable('people', function (table) { table.increments('id').primary(); table.string('first_name').notNullable(); table.string('last_name').notNullable(); table.text('bio'); table.timestamps(true, true); }); }; exports.down = function (knex, Promise) { return knex.schema.dropTable('people'); }; How can I avoid this?

Submitted December 06, 2017 at 11:46AM by honestserpent

Patterns for designing flexible architecture in node.js (CQRS/ES/Onion)

http://ift.tt/2AdiEzu

Submitted December 06, 2017 at 09:54AM by domagoj412

Migrating server from PHP to node.js

Hello,I will be migrating my application's backend started ages ago from PHP(zend) to node.js. What would be the best approach to do it without completly freezing development or developing 2 branches at one time? I need to provide high uptime with frequent updates and I'd like to avoid both cases. For me best approach would be to somehow be able to start migrating endpoints one by one and adjusting frontend only for them (with eventual possibility to keep 2 servers temporarly at one time with part of requests being made to one and rest to the other, but this does not seem very... good practice?), while keeping yet untouched ones on PHP. I was thinking about microservices but I am not sure if this will be really best approach.Anyone with similar experience that can be shared? Thanks!

Submitted December 06, 2017 at 08:06AM by sniegoman

Tuesday, 5 December 2017

[Show Off] HashBrown CMS is out of beta

HashBrown is a free and open source headless CMS that works both as an API and a deployment system. It's designed with several projects, environments and endpoints in mind. It's written in node.js with as few dependencies as possible.We've worked on it intensively for over 2 years, and we're quite proud of how it's turned out.Read all about it at the official website. If you're interested, please help us break it and submit bug reports on the issue tracker, or ask a question on /r/HashBrownCMS

Submitted December 06, 2017 at 05:17AM by jzapp

Building a simple API in Node.js using Vaxic - Medium

http://ift.tt/2B2xc52

Submitted December 06, 2017 at 02:23AM by Etha_n

Node v8.9.2 (LTS)

http://ift.tt/2AZXmFu

Submitted December 05, 2017 at 11:01PM by dwaxe

Best practice for Web/Mobile API?

Hey all, I'm new to this side of things and have a question. I'm designing a node server (using express) to run on both web and mobile that interacts with a mongoose database. I want to be able to manipulate json data and then parse it into my database objects while also being able to create/delete/edit the objects from any platform. The trouble I'm having is deciding the best practice for accomplishing this. My hunch is to write the API as middleware and then have two separate routers to deal with web vs mobile requests (mainly because web calls will result in redirects etc whereas on mobile that can all be handled with native code). Can someone push me onto the correct path?Extra, probably relevant, detail: At the moment I've elected to use pug as my templating engine since it's fast and easy and I'm really only in the prototyping stage of what I'm doing.

Submitted December 05, 2017 at 08:43PM by kuzaikami

Having trouble saving an audio/ogg recording to file system with node.

On the client I am using the browser's mic to record audio. The result is this:Blob(36433) {size: 36433, type: "audio/ogg; codecs=opus"} I then send the data to my Node.js server and attempt to save the file:req.on('data', (data) => { fs.writeFileSync('someAudio.ogg', data); }); However, the .ogg file does not work, it seems corrupt or something. Do I need to encode it? It seems like it's already encoded on the clientside?Maybe I am sending the blob file incorrectly to Node.js?addAudio(projectId, blob) { let formData = new FormData(); formData.append('upload', blob); return this.httpClient.post('http://localhost:3000/api/projects/audio/' + projectId, formData, {responseType: "blob"}); }

Submitted December 05, 2017 at 07:49PM by Ryan_77