I'm about to defenestrate this computer, so forgive the wall of text please.I've had this problem before twice. The first time, it was because the returned object was actually an unfulfilled promise, and I was able to get around it by throwing all my code inside of the block so that it would execute in there. Not exactly an ideal solution but it worked and I was in a hurry.The second time I was using pg-promise instead of just pg, and when this issue popped up I thought "it must be that damn promise again", so instead of tearing my hair out I just uninstalled pg-promise and went with the regular postgres package for nodejs instead. Well, the problem is still here and I'm tearing my hair out.I'm making an API. I have a controller with functions such as getPayment and postPayment and so on. At some point in these functions, I need to get information from or into the database. In another file, which I called postgres.js, I have a connection to the database and then functions which I can call to insert data, select, etc. Here is postgres.js as it is right now (this works but only for printing to console):module.exports = { select: select }; const { Client } = require('pg'); const client = new Client({ user: 'myUser', host: 'localhost', database: 'myDB', password: 'myPassword', port: 5432, }); client.connect(); function select(){ client.query('SELECT * FROM payments', (err, res) => { console.log(err ? err.stack : res.rows[0].id); client.end(); }); } As you can see right now all it does is get the payments from the table and print a value (in this case, the first row's id) to console. Here is the code that calls this function, from the controller (payments.js):var pg = require('../../config/postgres.js') ... function getPaymentInfo(params){ // get info from the DB // disregard the fact that I'm not sending any params right now, this is for testing var result = pg.select(); console.log(result); console.log(typeof result); } Calling pg.select() does in fact activate the select function on postgres.js (and the console log correctly prints the data in res.rows[0].id) however when I try putting a return res.rows[0].id there in order to actually return the information that was retrieved from the database, what comes back into the var result is "undefined" according to the console. Here are a few examples of things I've tried to do to get the data out:function select(){ var i = ''; client.query('SELECT * FROM payments', (err, res) => { //console.log(err ? err.stack : res.rows[0].id); i = err? err.stack : res.rows[0].id; client.end(); }); return i; } I tried this with and without commenting the console.log line, either way it doesn't work.function select(){ client.query('SELECT * FROM payments', (err, res) => { //console.log(err ? err.stack : res.rows[0].id); return err ? err.stack : res.rows[0].id; //client.end(); }); } Instead of printing t console, just return the result of that little error check up there... returns undefined.function select(){ return client.query('SELECT * FROM payments', (err, res) => { //console.log(err ? err.stack : res.rows[0].id); // Hello World! client.end(); return err ? err.stack : res.rows[0].id; }); } Returning the return from client.query(etc etc);.. same thing as before. Also tried without the explicit return, without checking for error, all the same.Here's the last test I tried:function select(){ var i = 'original i'; client.query('SELECT * FROM payments', (err, res) => { console.log(err ? err.stack : res.rows[0].id); // Hello World! if (err){ i = "i has changed!"; } else { i = "i has not changed!"; } client.end(); }); return i; } The console shows this:original i string 2 That last "2" being res.rows[0].id.I really believe this must have something to do with the blasted "promises" and asyncronous stuff. But my previous "solution" won't fit here. I can't just do everything inside of that block where I have access to res. I have to be able to return some data back to getPaymentInfo().It seems that client.query(...) is waiting for every line in getPaymentInfo() to be ran before actually doing anything. I can see that because in the console, the results of console.log(result) and console.log(typeof result) appear before the line that shows information from the table (from console.log(err ? err.stack : res.rows[0].id) ). That is absolutely infuriating.I saw some examples out there that used await, but when I tried to add that copying the examples, it gave me a syntax error as if it didn't recognize what await is supposed to be. There was an example with yield as well, same error. It doesn't know what those commands mean. I'm using the latest version of nodejs (v8.10.0).I also tried using then to get it to wait:function generatePaymentInfo(params){ ... pg.select().then(function(v) { console.log(v); }); ... } It gives me this error:TypeError: Cannot read property 'then' of undefined What's going on here? How do I get it to do things in the right order? All I want is to get some information from a table. Every example for the pg package (and pg-promise as well) I see out there just has a console.log() representing "success". In reality what anyone would want is to have actual access to the data. The level of shenanigans going on here is officially too much. This isn't AJAX. I don't need this to be asynchronous! It's all happening in the server! It could very well go in there, get the data, return it, and keep going just how god intended it to! But how??
Submitted March 31, 2018 at 10:59PM by geleiademocoto
Saturday, 31 March 2018
Iterate faster with this deal simple, super fast key-value API
https://keys.run
Submitted March 31, 2018 at 07:04PM by theoszymk
Submitted March 31, 2018 at 07:04PM by theoszymk
How do you optimally structure a MongoDB database to fetch all properties of a user?
I'm building an app where a user object has multiple game objects. What would be the proper strategy for fetching all of a user's games from a mongoDB database?As far as I can tell I have 2 options:1: One option is to give users a game property that is an array of ids of games that the user has and then fetch each game individuallye.g.example user{ _id: '1342', name: 'Dave', games: [ '12345678', 'fgnhe45rnd', ], }example game{ _id: '12345678', name: 'Fluxx', }2: The opposite. Give each game a users property that is an array of ids of users that own that game. Then fetch all games that have a specific user's id.e.g. example user{ _id: '1342', name: 'Dave', }example game{ _id: '12345678', name: 'Fluxx', users: [ '1342', '5783', ], }Any advice is appreciated. Thank you.
Submitted March 31, 2018 at 05:03PM by yonatanmk
Submitted March 31, 2018 at 05:03PM by yonatanmk
Java is to Spring MVC as JavaScript is to "_______"
It seems like java based web development is synonymous with Spring MVC.For Node, I am looking for the default framework.Here's what I need:Rapid Web App DevelopmentServer Side TemplatesBuilt in user auth with JWT tokenDefault configurations of routes that are accessible by routes/admins. Only users can access /user/... and admins can access /admin/**ORM or easy connectivity to MySQL or PostgresSpring supports all of the above and is extremely easy to work with.I need JavaScript because another project I use is JavaScript based and I want to share the code. Thoughts?
Submitted March 31, 2018 at 05:13PM by bjj_question
Submitted March 31, 2018 at 05:13PM by bjj_question
Best way to host a node.js Discord plugin 24/7?
Hey all,Quick question.I made a discord bot using Node.js, and it runs fine on my computer.How ever i was wondering what you guys think the best host is. Also one that is simple enough.
Submitted March 31, 2018 at 02:54PM by BOWTELL
Submitted March 31, 2018 at 02:54PM by BOWTELL
How many hours to learn NodeJS as an experienced PHP MVC/ReactJS dev?
It's a question that gets asked a lot "How long to learn...?", but I wanted to ask when giving some more details of my previous experience.Title says it all really - I have quite extensive experience in PHP MVC (Yii2), ReactJS/Redux, jQuery, vanilla JS, MySQL/RDBMS etc. I am building a new app in PHP with a React frontend which is nearing completion. However, while developing it I have been using AWS for the first time and looking more and more into backend/server technologies and language performance. I am starting to think NodeJS is the way forward and I might look to transition this new app into Node/Express once I have the initial PHP version up and running.Realistically speaking, how many hours am I looking at to reach a professional-level proficiency in Node? I am a dedicated learner, putting 2-3 hours (or more) aside each day (7 days a week) to learn Node shouldn't be an issue.Also, how good/intuitive is Sequalize as an ORM?
Submitted March 31, 2018 at 01:04PM by U4-EA
Submitted March 31, 2018 at 01:04PM by U4-EA
How to test number of HTTP requests an API can handle per minute
I want to test how many requests my API (an express app run locally) can handle per second. I wrote a bash script which calls 'curl' to the API in a loop and takes an argument designating the number of curl calls. However, I think the bottleneck is on the testing end. I don't think I'm seeing the amount of API calls the API can handle, but rather the amount of calls my local machine can generate. Is there a simple way to test an API like this? Is there a test framework that can generate high volumes of calls?
Submitted March 31, 2018 at 01:16PM by GuyF1eri
Submitted March 31, 2018 at 01:16PM by GuyF1eri
code generation vs config file (app generator)??
I wonder how Dialogflow (or other services) stores their users' config and generate each app for each user config.Does it generate code for each user or does it just save each config and pass it to the central app which has so many conditional checking like if(userOption == "enabled"){}.Which is the most optimized way to automatically create each app for each user? Is it by code generation (generating javascript files for each user which has its own link) or config file (generating app by central app which does many conditional checking for each user config)? I'm trying to build one for my project. Take Dialogflow as the case study if you think the answer is too broad. It'll be great if the factors to choose which way are explained.
Submitted March 31, 2018 at 05:15AM by terry_ds
Submitted March 31, 2018 at 05:15AM by terry_ds
Friday, 30 March 2018
Hiding an api key?
I have a program that I am writing while learning, that I'd like to post on gitHub, but I'm wary of accidentally posting a private key, and want to know how I hide the details of the key from anyone looking at the code and still have the code work?
Submitted March 31, 2018 at 01:16AM by Mymar
Submitted March 31, 2018 at 01:16AM by Mymar
Node.js configuration and secrets management
https://ift.tt/2J5Osak
Submitted March 30, 2018 at 10:38PM by kiarash-irandoust
Submitted March 30, 2018 at 10:38PM by kiarash-irandoust
Packaging Node.js code into cross platform executables
https://ift.tt/2E7jFpR
Submitted March 30, 2018 at 08:16PM by sheshbabu
Submitted March 30, 2018 at 08:16PM by sheshbabu
Learn everything you need to become a Node.js Developer with practical exercises & projects
https://ift.tt/2uvEV9m
Submitted March 30, 2018 at 07:05PM by sanithaanjk
Submitted March 30, 2018 at 07:05PM by sanithaanjk
Final year project ideas
I'm a computer science student and I have fyp coming up and can't think of any ideas. My interest is in web application. Stack: Node.js backend / any js framework on frontendWe had orientation class yesterday and were told that simple projects such as e-commerce website or any management system (library, hospital, etc) are not expected. We are advised to use Data Structures and Algorithms, Cryptography or AI for our projects.I have been brainstorming for a day and can't come up with any ideas. Do you have any suggestions?
Submitted March 30, 2018 at 06:52PM by aidrayhop
Submitted March 30, 2018 at 06:52PM by aidrayhop
Anyone using LDAP auth with HapiJS?
Long time Koa/Passport user ... LDAP is a supported strategy and easy to implement.Started looking at Hapi v17. Apparently the "Bell" package is the Hapi equivalent of passport, but it doesn't support LDAP. Anyone get this working?
Submitted March 30, 2018 at 06:56PM by djslakor
Submitted March 30, 2018 at 06:56PM by djslakor
Getting Started With IBM Cloud Functions and MongoDB
https://ift.tt/2pR0xYZ
Submitted March 30, 2018 at 05:08PM by code_barbarian
Submitted March 30, 2018 at 05:08PM by code_barbarian
Node.js Top 10 Open Source Projects for the Past Month-v.Mar 2018
https://ift.tt/2pToZIa
Submitted March 30, 2018 at 03:36PM by kumeralex
Submitted March 30, 2018 at 03:36PM by kumeralex
Project idea for Node beginner
Hi, Last month I posted this https://ift.tt/2G4UVkP According to the most of the suggestion, I have completed this course. I am now seeking some idea to build my portfolio. What kind of node based projects will be good for portfolio. Can you share some ideas?
Submitted March 30, 2018 at 03:20PM by tech3ad
Submitted March 30, 2018 at 03:20PM by tech3ad
Livechat support system with react & Socket.io[help]
https://ift.tt/2uDqYpA
Submitted March 30, 2018 at 02:08PM by ifydav
Submitted March 30, 2018 at 02:08PM by ifydav
From Express.js to AWS Lambda: Migrating existing Node.js applications to serverless
https://ift.tt/2uBEqdM
Submitted March 30, 2018 at 12:51PM by slobodan_
Submitted March 30, 2018 at 12:51PM by slobodan_
Puppeteer versus "I am not a robot"
I am really interested in automation so I've started studying puppeteer today and am slowly gaining an understanding of how it works. and this got me thinking about the often seen "I am not a robot" box that you sometimes have to click with filling in a form, registering etc. Like I said I've only been studying puppeteer for a couple of hours but it seems to me that it should be fairly simple to write scripts that can beat that "I am not a robot" checkbox.I would think you could easily inspect the checkbox to get its id or other CSS identifier and then do something like:await page.click("#checkbox"); but if that's true that would mean the "I am not a robot" security measure that is used so often is a complete joke..
Submitted March 30, 2018 at 11:45AM by DutchSparks
Submitted March 30, 2018 at 11:45AM by DutchSparks
Ask Me About Javascript: a place where we answer technical questions on the language.
https://ift.tt/2pPXkZr
Submitted March 30, 2018 at 10:02AM by parro-it
Submitted March 30, 2018 at 10:02AM by parro-it
Highly used 10 Programming Languages by Developers in 2017, all stats strictly based on GitHub’s data and TIOBE Index
https://ift.tt/2J4hN4Y
Submitted March 30, 2018 at 07:26AM by 2sbro
Submitted March 30, 2018 at 07:26AM by 2sbro
Thursday, 29 March 2018
The node image received a major update today and has reduced in size from over 800mb back to around 650mb.
https://ift.tt/2GiU5Qv
Submitted March 29, 2018 at 07:16PM by weighanchore
Submitted March 29, 2018 at 07:16PM by weighanchore
When to use RS256 for JWT?
So, right now I'm building an API for third parties uses and I was reading about RS256 and HS256. What I understood was that diff between is that in the first one you use a public key to verify and a private key to sign, and the other one, use just one key.. So what I don't understand why you would like to verify the token in the client? Because you do a post request to the server, then it sends you back the token and whenever you want to make an authorized request you just use the token and the server verifies the token. So, why you would like to verify the token in the client? I thought it was a backend's duty.I think maybe I'm wrong in something, hope you help clear this. Thanks.
Submitted March 29, 2018 at 07:19PM by foocux
Submitted March 29, 2018 at 07:19PM by foocux
Read configuration changes from a file on the fly
I have a directory full of config files which my server is reading on startup. I would like to make changes to these files and have my server read them without a restart.Is this possible with an NPM module?
Submitted March 29, 2018 at 06:39PM by roosrock
Submitted March 29, 2018 at 06:39PM by roosrock
Generating UML diagrams from TypeScript source code with TsUML
https://ift.tt/2FkBuDP
Submitted March 29, 2018 at 04:43PM by ower89
Submitted March 29, 2018 at 04:43PM by ower89
Open source projects to learn from
I am part of a project where we're going to be using nodejs in the backend,i only know how to make a simple server in node,are there any open source projects which i can read so i can get my hands dirty? I am going to work on push notifications if it helps.
Submitted March 29, 2018 at 02:30PM by PowerfulEntrance
Submitted March 29, 2018 at 02:30PM by PowerfulEntrance
Possibility of session hijacking
Expressjs/session is a pretty widely used middleware for handling sessions.I would like to know how the client might exploit weak sessions secret, for example default in docs value "secret". Anybody having such knowledge willing to enlighten me?
Submitted March 29, 2018 at 02:41PM by bablador
Submitted March 29, 2018 at 02:41PM by bablador
How to build a simple Twitter bot in 17 lines of code
https://ift.tt/2Fra2nD
Submitted March 29, 2018 at 07:46AM by Vikas6190
Submitted March 29, 2018 at 07:46AM by Vikas6190
Wednesday, 28 March 2018
ALB sends a HTTP 502, each time my Node JS server receives a query with \x in the encoding instead of a % in the encoding. Any idea what could be the issue and how to fix it?
No text found
Submitted March 28, 2018 at 10:54PM by mojorojo2
Submitted March 28, 2018 at 10:54PM by mojorojo2
Node.js Security Release Summary - March 2018
https://ift.tt/2J1mEDZ
Submitted March 28, 2018 at 06:38PM by _bit
Submitted March 28, 2018 at 06:38PM by _bit
Node v4.9.0 (Maintenance)
https://ift.tt/2J47wWj
Submitted March 28, 2018 at 05:41PM by dwaxe
Submitted March 28, 2018 at 05:41PM by dwaxe
Node v6.14.0 (LTS)
https://ift.tt/2IbDpex
Submitted March 28, 2018 at 05:41PM by dwaxe
Submitted March 28, 2018 at 05:41PM by dwaxe
Node v8.11.0 (LTS)
https://ift.tt/2J32RUr
Submitted March 28, 2018 at 05:41PM by dwaxe
Submitted March 28, 2018 at 05:41PM by dwaxe
Node v9.10.0 (Current)
https://ift.tt/2IamaKj
Submitted March 28, 2018 at 05:41PM by dwaxe
Submitted March 28, 2018 at 05:41PM by dwaxe
An overview of the JavaScript ecosystem, from frontend to backend, passing by Node in the process
https://ift.tt/2pMyZ77
Submitted March 28, 2018 at 04:44PM by sandrobfc
Submitted March 28, 2018 at 04:44PM by sandrobfc
Server-side Debugging for Node projects
https://ift.tt/2IenY5k
Submitted March 28, 2018 at 05:12PM by GarethX
Submitted March 28, 2018 at 05:12PM by GarethX
How Pipedrive builds its back-end with Node.js & PHP
https://ift.tt/2J1xjyu
Submitted March 28, 2018 at 01:45PM by andreapapp
Submitted March 28, 2018 at 01:45PM by andreapapp
Nodejs - avoid blocking the event loop
I have reading a lot about the event loop in Nodejs, the fact that it is "single threaded" and that you should not block the event loop.I am trying to understand if Node.js is a good choice for the following scenario, because I guess I still haven't figured that out.I have sensors that every 5 minutes collect some data (for instance, think of the temperature) and then send data to the server. When the sensors are online, no problem. They send very little information (basically the body can be summarized as [timestamp, sensor_id, temperature]). The sensors retain the data up to a certain amount of time (depends from sensor to sensor, could be like 6 months). Unfortunately, these sensors are not reliable and it could happen they they get stuck, blocked, or, anyway, for whatever reason, they are not able to send data for a certain period of time. The period of time could even be months long (i'm not gonna explain why, it's bullshit, but that is what it is).The sensors are not-so-smart. If they were blocked, whenever they go back online they send everything they didn't send in a single , one-time, POST request to the server.The point is, the server receives the requests and has to do some work on every single data contained in the body before writing it into the database. The work is simple but it's a CPU operation (it's just a simple sum), nothing really CPU-intensive like AI or whatever else. This means that the computational complecity is O(n), so it grows linearly with the number elements of the body.Most of the times the requests are super simple and short and contain a single data record, so the complexity is basically O(1), but when it happens that a sensor sends a huge packet, the backend would have to loop over it and this would block the event loop thus making the server unresponsive.I am wondering what would be the good and proper way to handle such a load using Nodejs.Any suggestion is appreciated in order to seek the best solution and learn Nodejs better.
Submitted March 28, 2018 at 02:12PM by honestserpent
Submitted March 28, 2018 at 02:12PM by honestserpent
Discussion to add Websocket support to NodeJS core
https://ift.tt/2petopE
Submitted March 28, 2018 at 10:52AM by fagnerbrack
Submitted March 28, 2018 at 10:52AM by fagnerbrack
Angular and Node.js Integration
https://ift.tt/2pLys5n
Submitted March 28, 2018 at 07:08AM by udemyfreebies
Submitted March 28, 2018 at 07:08AM by udemyfreebies
Tuesday, 27 March 2018
Question regarding node-schedule
New to node. So i built a script to automate a task every night at midnight using node schedule, and it works perfectly on the local server. however, it doesn't work in AWS, as i dont see anything in the documentation regarding ports. has anyone successfully deployed a script to aws that uses node-schedule?
Submitted March 28, 2018 at 01:32AM by candy_cock_boi
Submitted March 28, 2018 at 01:32AM by candy_cock_boi
Node Question
I have been building a website for awhile. I'm using html, css, and js. I have built a stripe button which uses node. I have to go to the terminal and type in node app.js to see my work (in this case the stripe form) in the browser.When I add the node work I've done (stripe form) into my webpage, how do I open it with my server on VS code or any server? In other words, I know it can't be done... but how does it work. How do you get your node to work on your website?Thanks,
Submitted March 27, 2018 at 11:16PM by tim246
Submitted March 27, 2018 at 11:16PM by tim246
Objection.js (or rather, knex schema builder)
So I've been using objection.js for a while, and I've read in their API:Create database schema. You should use knex migration files to do this.So I looked into the knex migrations and I have some issues. I've already posted this to their github, with lackluster response.tl;dr: I was using knex migrations for an app with this schema (give or take) representing my database:exports.up = function (knex, Promise) { return knex.schema .createTable('servers', function (table) { table.increments('id').primary(); table.string('serverName', 50); table.integer('fault_id').references('faults.id'); }) .createTable('faults', function (table) { table.increments('id').primary(); table.text('faultDescription', 'longtext'); }); }; exports.down = function (knex, Promise) { return knex.schema .dropTable('servers') .dropTable('faults'); }; I've been using this database for a while now and I have lots of data already in the database. Now I want to add another column to the servers table, using knex migrations.If I run knex migrate:rollback I've lost all the data. If I change the schema and run knex migrate:latest I get an error that it's already up to date. If I create a new schema with alterTable, I've lost reference to the schema above. I literally don't see a way of using schema migrate to solve this issue.What is the correct approach?
Submitted March 27, 2018 at 07:41PM by JavascriptFanboy
Submitted March 27, 2018 at 07:41PM by JavascriptFanboy
Is there a restart monitor that is also a node console when running?
nodemon and supervisor take their own small set of commands. Is there a similar util that, when started, acts as node or js console?
Submitted March 27, 2018 at 07:06PM by monsto
Submitted March 27, 2018 at 07:06PM by monsto
[Question] Resizing and compressing remote images
Hey guys, I've been working on a problem for quite a while.I have a website that uses images from a database, these images can be quite large (1.5MB).I've been trying to scale the images before sending them to the user... But no success.I've tried using fs.stat to check if the requested image is present if not I used fs.writeFile and after that I used sharp an NPM package for image resizing.This makes my whole website very slow.I believe this can be done by using Blob? But I'm not quite sure how, because I'm pretty new to Node.js.Could someone offer me some advice on how to do this correctly without ruining page load? :) Thanks!
Submitted March 27, 2018 at 06:43PM by Cookiemuncher69
Submitted March 27, 2018 at 06:43PM by Cookiemuncher69
Vesper - framework to create a scalable, maintainable, extensible, declarative and fast GraphQL-based server applications.
https://ift.tt/2pK01Ly
Submitted March 27, 2018 at 03:21PM by pleerock
Submitted March 27, 2018 at 03:21PM by pleerock
EU Citizens - Let's Save Code Share!
https://ift.tt/2Gay4Hy
Submitted March 27, 2018 at 02:41PM by andreapapp
Submitted March 27, 2018 at 02:41PM by andreapapp
Scheduling Slack messages using AWS Lambda – freeCodeCamp
https://ift.tt/2Gp0ooS
Submitted March 27, 2018 at 02:16PM by slobodan_
Submitted March 27, 2018 at 02:16PM by slobodan_
TypeScript library to create GraphQL schema and resolvers, works well with typeorm
https://ift.tt/2Gw3t6N
Submitted March 27, 2018 at 01:57PM by redgiant6157
Submitted March 27, 2018 at 01:57PM by redgiant6157
I want to generate QR codes with a logo in the middle, need guidance
If I can get the QR code generator, do you have a suggestion on how to get a logo placed on the QR code? Im guessing I should look for a lib like imagemagik?
Submitted March 27, 2018 at 12:03PM by trapulator
Submitted March 27, 2018 at 12:03PM by trapulator
GraphQL over REST with Node, Heroku, and Apollo Engine
https://ift.tt/2HC0uXc
Submitted March 27, 2018 at 08:29AM by harlampi
Submitted March 27, 2018 at 08:29AM by harlampi
Is there an easy way to store a JSON return into a variable and work with after that?
So, long of the short, I am trying to work with an npm that returns a JSON file with stock information. Here is a link to the NPM:LINK: https://ift.tt/2Gbd1F1, all I want to do is to pull say a daily quote for AAPL. Well, I can see I can do this from the API instructions:alpha.data.daily('AAPL', 'compact', 'json', 'daily').then(data =>{ console.log(data); }); Well, that works and brings back 100 different stock days of information about the stock.However, I want to try to make that useful. I am attempting to set that data that is consoled out to a variable. Then, I want to parse through the JSON and say get data from a specific day. Say, the opening for a specific date.I have tried several ways to do this, but can't seem to figure out how to do it. Attempts have brought "promise" to also bringing just empty variables.I am basically lost at this point and googling doesn't seem to be coming up with a good answer. Does anyone know a good way I could set an API call to a variable and then parse through the JSON once it is in that variable?Thanks for any help.
Submitted March 27, 2018 at 05:18AM by osualgorithmstuff
Submitted March 27, 2018 at 05:18AM by osualgorithmstuff
Monday, 26 March 2018
I can't for the life of me work this out (mongo aggregation error)
Trying to run this using MongoDB. const users = await Users.aggregate([ { $geoNear: { near: { type: "Point", coordinates: [ -73.99279 , 40.719296 ] }, distanceField: "dist.calculated", spherical: true }, $match: { $and: [{ gender: `${match}` }, { _id: { $ne: ObjectId(`${id}`) } }] } } ]) and getting the error: "Arguments must be aggregate pipeline operators"Both the $match and $geoNear WORK separately. When I bring em together it doesn't. Any thoughts?
Submitted March 27, 2018 at 01:26AM by jamesfriedal
Submitted March 27, 2018 at 01:26AM by jamesfriedal
is this course good to learn node?
Hello everyone, i used laravel until now to do my personal projects and now i want to learn something new so i come with nodejs and I would like to learn it properly, so my question: is this good?https://ift.tt/2IVRnCb for 10€ what you think?
Submitted March 26, 2018 at 11:59PM by syszen
Submitted March 26, 2018 at 11:59PM by syszen
Building a Chat for a Dating Site. Need some advice!
Making a dating site and I want to implement messaging between users. I'm not sure about the best functionality for this. Here's my options:a) NOT live messaging. Messages POST to backend. Requires a page refresh to display new messages.b) LIVE messaging! Making use of web sockets. I would also have to save any live messages in a database. and loop through them like facebook when user logs back in.Obviously I'd want option B, but I have very little experience with socket.io and have no idea how complex it would be?I feel like it could be quite tricky because every new conversation between two users would require a new socket. I also have about 1/2 weeks to implement this. Just wandering if anyone could shed any light on how complex live messaging would be? Or point me to any good tutorials. (All tutorials seem basic. just two users)Thanks!
Submitted March 27, 2018 at 12:24AM by harrydry
Submitted March 27, 2018 at 12:24AM by harrydry
Monitoring MongoDB connection status in node.js app
I've written a new blog post about Monitoring MongoDB connection status in node.js app (with typescript)This post covers:checking MongoDB connection status using the .isConnected() methodlistening to MongoDB events like: closed, reconnect, timeout and otherssetting appname and checking what applications are connected to a databaseI would be really glad if you can share your thoughts about it. All feedback is welcome. Thanks in advance!
Submitted March 26, 2018 at 09:54PM by ramlez
Submitted March 26, 2018 at 09:54PM by ramlez
Here’s how you can actually use Node environment variables
https://ift.tt/2Fmk5hv
Submitted March 26, 2018 at 10:21PM by dobkin-1970
Submitted March 26, 2018 at 10:21PM by dobkin-1970
Controller library with built in HMR.
https://ift.tt/2I7NGIB
Submitted March 26, 2018 at 07:53PM by philipodev
Submitted March 26, 2018 at 07:53PM by philipodev
New NodeJs chatroom on Discord - Nodeiflux
Hey /r/node,I'm one of the moderators of Reactiflux, and since we've gotten a steady stream of people asking node-specific questions, we've started up a sister server on Discord, Nodeiflux. The name is for thematic consistency, there's no relation to Flux :)Reactiflux is the largest online chatroom for React developers with around 2500 devs online at peak hours, so we're hoping we can foster a helpful and friendly community for some of the other parts of JS as well!The link to join is https://ift.tt/2GwMQbc
Submitted March 26, 2018 at 07:54PM by vcarl
Submitted March 26, 2018 at 07:54PM by vcarl
If I’m using Docker does it make clustering obsolete?
No text found
Submitted March 26, 2018 at 08:24PM by Mingli91
Submitted March 26, 2018 at 08:24PM by Mingli91
Anatomy of a Passport enabled Express App?
I can't seem to find a clear, concise tutorial on what is required to implement passport in Express Applications. I mean, I know that I need to include passport and the strategy I will use, but there's no high level overview of things to do with passport.I guess the questions lingering in my mind are:where do we put the Passport.use statements so that express will know that passport is being used? right in the middleware stack? (Ex: app.use(passport());??)what routes should be available for the purpose of sign-in/Registration? (Ex. GET/POST for /register, /login)What steps should be taken in these routes?(ex. check for user in DB, compare password, re-route to protected route after authentication, etc....)What should the app be doing during an authentication enabled route? (so I can understand what my app is doing during the process, for debugging purposes.)Not sure I've asked everything, and I'm sure I'm not the only one that has these types of questions. I can understand that no one really has this completely figured out, but something as popular as Passport should be documented, regardless of whether it's officially marked down.There has to be an explanation somewhere. Resources for answering the questions are good too.
Submitted March 26, 2018 at 06:50PM by cjrutherford
Submitted March 26, 2018 at 06:50PM by cjrutherford
Debugging node without restarting processes
https://ift.tt/2GaBF4A
Submitted March 26, 2018 at 06:14PM by InRhythmInc
Submitted March 26, 2018 at 06:14PM by InRhythmInc
Traverse each nested object and create a div for each of them (EJS)
Using the following object, I need to create a HTML div element for each obj in that array using EJS.The div should look something like this:
Using the real info from the first object:
(Of course if the "reply to reply" has a reply, it needs to be in that div too)The object itself: let obj = [ {"id":1,"comment":"First Updated Comment","parentID":null,"replies": [{"id":5,"comment":"This is a reply to comment ID 1","parentID":1,"replies": [{"id":9,"comment":"reply To reply ID 5","parentID":5,"replies":[]}]}]}, {"id":2,"comment":"Second Comment","parentID":null,"replies":[]}, {"id":3,"comment":"Third Comment","parentID":null,"replies":[]}, {"id":4,"comment":"4th Comment","parentID":null,"replies":[{"id":6,"comment":"Reply to Comment ID 4 ","parentID":4,"replies":[]}]}, {"id":7,"comment":"Testing BLACK ","parentID":null,"replies":[]}, {"id":8,"comment":"TriHard 7 comment id 7","parentID":null,"replies":[]} ] Thank you for your time.
Submitted March 26, 2018 at 05:41PM by khazha88
Original comment
The replies of that original comment
The replies of the replies etc
First updated comment
This is a reply to comment ID 1(the comment above)
reply to reply ID 5(the reply above)
Submitted March 26, 2018 at 05:41PM by khazha88
Cant install express. Npm install returns errors
Hi there.As stated so am I unable to install express. Im runing windows but have tried everything on the Linux subsystem. I have tried running everything as an admin/root but without luck.Thankful for help
Submitted March 26, 2018 at 04:32PM by LegendenLajna
Submitted March 26, 2018 at 04:32PM by LegendenLajna
My First Node Js Open Source Project
Hello All,I have created a simple tool which will allow us to share files over the same network from terminal via QR code.Here is the repo : https://ift.tt/2GssgIL share your thoughts!
Submitted March 26, 2018 at 03:37PM by antoaravinth
Submitted March 26, 2018 at 03:37PM by antoaravinth
TravisBuddy is a service that integrates with TravisCI and GitHub in order to let your contributors know why their PRs fail the tests and what they need to do to fix it
https://ift.tt/2pjtU5L
Submitted March 26, 2018 at 01:35PM by mrbluz
Submitted March 26, 2018 at 01:35PM by mrbluz
Node.js server crashes (?) without an error message, and only when no one's looking.
https://ift.tt/2IUyBLp
Submitted March 26, 2018 at 01:21PM by Ultra_Penguin
Submitted March 26, 2018 at 01:21PM by Ultra_Penguin
Modern Frontend Developer in 2018
Hey Guys,You might have seen this "developer-roadmap" shared in this subreddit at the beginning of this year. There was still a lot of room for improvement, so I started updating it this weekend. I am still working on improving the Backend and DevOps ones but the frontend one is ready. To give you an idea about the updates, I have written a detailed article on medium. Here is the summary of what has been updatedUpdated some suggestions here and thereAdded details on how to follow – more beginner friendlyAdded tips to practice and get betterRemoved the "obsolete" partsHave a look at the article on medium if it may help anyone :)Thanks.
Submitted March 26, 2018 at 12:22PM by kamranahmed_se
Submitted March 26, 2018 at 12:22PM by kamranahmed_se
Simple to use Youtube APIs in javascript. ES6 supported.
https://ift.tt/2G7S1ir
Submitted March 26, 2018 at 11:02AM by goravsingal
Submitted March 26, 2018 at 11:02AM by goravsingal
Cannot for the life of me figure out how to use Jade.
Hey guys,So I'm running a basic Express webserver that I copied off of the internet. I wanted to use PHP includes but quickly realized that that's not really how node.js rolls. Found out that this "templating engine" called jade can accomplish something similar to php includes, and it's already on my webserver, great!I have absolutely no idea how to get it to work. So right now my website is a bunch of html, js, and css files in the "public" directory. On a PHP server, all you do is change the extension to ".php" instead of ".html" - this is not how Jade works. Jade runs off of a "views" folder and I have no clue what to do with it. Do I change all the extensions to ".jade" and move everything into the views folder? What am I meant to do here??
Submitted March 26, 2018 at 06:22AM by MitchTJones
Submitted March 26, 2018 at 06:22AM by MitchTJones
Path in NodeJS a quick guide
https://ift.tt/2upyGDW
Submitted March 26, 2018 at 08:08AM by Steeljuice1
Submitted March 26, 2018 at 08:08AM by Steeljuice1
Sunday, 25 March 2018
Express middleware to protect against DNS Rebind attacks
https://ift.tt/2ujFyCv
Submitted March 26, 2018 at 02:01AM by brannondorsey
Submitted March 26, 2018 at 02:01AM by brannondorsey
Completely lost on running my apps. Tried AWS, but now they claim no space left on device. What do I do?
So, basically, I am familiar with programming with node.js. I have made a twitter bot that runs with node.js and runs on AWS. I already got it running.Well, I tried to create another app (another twitter bot for fun), but when I try to make a new folder on it and then "npm install" the needed files, I get the message "No space left on device".Well, honestly, I have no idea how much space I have on my account, no idea how to even tell what the issue is, and no idea on how to work around this.I am assuming it it saying that the files I have are too much for my account. But, no idea how to work around that.Has anyone run into this? Is there a way to run node apps that rely on libraries to run without using a lot of memory or storage on AWS? I am just confused why this take so much space on my account.Sorry, I'm new to this and just familiar with AWS because we used it in one of my classes in college. Thanks for any help with this.
Submitted March 26, 2018 at 02:38AM by osualgorithmstuff
Submitted March 26, 2018 at 02:38AM by osualgorithmstuff
Whats something you wish you learnt a lot sooner?
As a beginner I'm constantly learning new things and sometimes you have the feeling of 'if only I knew that in my last project..'
Submitted March 25, 2018 at 11:30PM by maldini94
Submitted March 25, 2018 at 11:30PM by maldini94
(Free) Node.JS Video Courses & Tutorials Recommended by Developers
https://ift.tt/2GkNlF4
Submitted March 25, 2018 at 07:37PM by adolfo2582
Submitted March 25, 2018 at 07:37PM by adolfo2582
How do I sort my comments/replies/replies to replies data properly
I am using Nodejs, Express, MySQL, EJS.Users are able to create posts and comment/reply to comments/reply to replies on those posts.The problem: I don't know how to sort the data into objects/arrays in a way that will allow me to render them in EJS. I know how to do it for comments and replies to the comments, but not to replies to replies. How to create an object/array(or objects/arrays) which will make it "easier/simpler" to manage the comments, replies and replies of replies of replies(...etc)?The idea: I believe the end product should look something like this:When rendering EJS, it will check the sorted data for comments, if there are comments, it will create 1 container div for that single comment(and for the replies of that single comment), each other comment will have it's own container div.In that container div, will be the main comment div which will contain only the comment.Below the comment div will be the replies to the comment div(maybe the replies to replies will be stored here too, or a div specifically for that will be created)(I don't need to do it in this way, you are allowed to do it in your own way, I just think this is not a bad way to do it)The "comments" MySQL table is: ID comment ReplyToCommentID -------------------------------------------------------- 1 | First Updated Comment | NULL 2 | Second Comment | NULL 3 | Third Comment | NULL 4 | 4th Comment | NULL 5 | This is a reply to comment ID 1 | 1 6 | Reply to Comment ID 4 | 4 7 | Testing here | NULL 8 | TriHard 7 comment id 7 | NULL The value in ReplyToCommentID means that comment is a reply to the comment with the ID of that value, the comments with ID 5 and 6 are replies to the comments with ID 1 and 4, if it's NULL, it means it's a normal comment to the post.Getting them from MySQL to Node returns them in this format: [{"id":1,"comment":"First Updated Comment","ReplyToCommentID":null},{"id":2,"comment":"Second Comment","ReplyToCommentID":null},{"id":3,"comment":"Third Comment","ReplyToCommentID":null},{"id":4,"comment":"4th Comment","ReplyToCommentID":null},{"id":5,"comment":"This is a reply to comment ID 1","ReplyToCommentID":1}, {"id":6,"comment":"Reply to Comment ID 4","ReplyToCommentID":4},{"id":7,"comment":"Testing here","ReplyToCommentID":null}, {"id":8,"comment":"TriHard 7 comment id 7","ReplyToCommentID":null}] Separating the comments and replies into their own object gives this. (Obviously) this is replies {"1":"This is a reply to comment ID 1","4":"Reply to Comment ID 4"} This is comments {"1":"First Updated Comment","2":"Second Comment","3":"Third Comment","4":"4th Comment","7":"Testing here","8":"TriHard 7 comment id 7"} I have spent a couple of days trying to figure this out, but it seems it's too much for my "student experience". (I am self-taught so I don't have someone to ask for help in real life)I would be very thankful if you help me with this.Thank you for your time.
Submitted March 25, 2018 at 04:33PM by khazha88
Submitted March 25, 2018 at 04:33PM by khazha88
Keep production Rest API files up to date
Hey everyone. I couldn't find a proper way to keep my node.js/expresd Rest API app's files up to date on my server. So for the moment I'm manually copy-pasting updated files.What should I do so that when I push my code to github (private repo) it automatically pushes the files on the server as well? Or maybe a command that is not even linked to the GitHub push, I'm just looking for a simpler way than copy-pasting.Edit:Ok I found something. Basically, I just have to setup another repo on my server, and push files there.This have crossed my mind, of course, but I thought maybe there was a better way.
Submitted March 25, 2018 at 04:37PM by SchrodingersBurger
Submitted March 25, 2018 at 04:37PM by SchrodingersBurger
This is just what I needed. I have made many things with Node.js, but haven't yet mastered it! This is certainly a great resource to begin my road to mastery.
https://ift.tt/2uhCZkC
Submitted March 25, 2018 at 12:20PM by sinapovozrno
Submitted March 25, 2018 at 12:20PM by sinapovozrno
Dawn of the Dead Packages
https://ift.tt/2Dkjsz1
Submitted March 25, 2018 at 10:26AM by ginger-julia
Submitted March 25, 2018 at 10:26AM by ginger-julia
What do you consider must-have packages?
So as a new developer, one of my biggest take-aways from my first project is trying to have a plan for ahead. Things like "How am I gonna deploy this? Dokku, nanobox or PM2?" and things like that.I learned about new things, such as socket.io and other cool modules. I have heard about Webpack, Morgan and so on, which I hope to ease my next project.So the question is, what packages would you recommend, a new developer take a look at?
Submitted March 25, 2018 at 10:08AM by HumbleBobcat
Submitted March 25, 2018 at 10:08AM by HumbleBobcat
Anyone used the egg.js? It looks pretty good
https://eggjs.org
Submitted March 25, 2018 at 07:15AM by plk83
Submitted March 25, 2018 at 07:15AM by plk83
Saturday, 24 March 2018
Write to and rotate logs using a counter instead of file size or expiration dates
https://ift.tt/2DSdCoV
Submitted March 24, 2018 at 06:45PM by davidk01
Submitted March 24, 2018 at 06:45PM by davidk01
Introducing TaskEasy - A simple priority queue for when you want to run things in sequence.
https://ift.tt/2GaK7AU
Submitted March 24, 2018 at 06:08PM by cmseaton42
Submitted March 24, 2018 at 06:08PM by cmseaton42
If my job is to get a job in react/node shop as a front end dev, I have a database question concerning graphql, mysql, mongo
Okay I think I am confused about wtf graphql is and whether it’s a substitute to MySQLShould I learn MySQL first ?Is graphql replacing MySQL ?If I’m trying to get a front end job coming from a front end boot camp with no knowledge of backend(learning node basics next Week)what do I do in regard to databases?
Submitted March 24, 2018 at 04:40PM by tony2times3
Submitted March 24, 2018 at 04:40PM by tony2times3
Advanced REST API guide needed
Hi guys,I wanted to ask whether you know of a good advanced REST API guide for express (bonus for postgres dB). We all have done the beginner stuff but I’m interested to get inspiration to do this:allow user to specify fieldsdynamic set of filters (isarchived) etc.pagination (no offset)searchBonus for: - request quotaWhat I’m facing is that by allowing users to make more complicated requests my query building and endpoints are getting very verbose.That might just be how it is but wanted to check what you masterminds have to say.Thanks a lot everybody!!
Submitted March 24, 2018 at 08:59AM by sirmcallister
Submitted March 24, 2018 at 08:59AM by sirmcallister
Friday, 23 March 2018
Awesome Node.js and JavaScript Meetups in North America
https://ift.tt/2pAr6Bo
Submitted March 23, 2018 at 10:46PM by _bit
Submitted March 23, 2018 at 10:46PM by _bit
TaskEasy - A simple, in-memory, lightweight, and promise-based priority queue.
https://ift.tt/2FYTBCX
Submitted March 23, 2018 at 06:28PM by cmseaton42
Submitted March 23, 2018 at 06:28PM by cmseaton42
How to position a reply to a comment depending if they share the same ID
I am using NodeJS, Express, MySQL and EJS.I have a 'posts' and a 'comments' table.The comments table has: ID, comment, ReplyToCommentID columns. If replyToID is a number, it means that it's a reply to the comment with that ID, if it's NULL, it means it's a regular comment.The problem: How do I display the replies to the comment with the same ID (or div value) as the ReplyToCommentID?I need something like:Creates the container div(which contains the div of the comment and possibly the replies) Creates the comment div Checks all the reply id's to see if the just made comment div's id is == with any of the reply id if true, create the div of the reply I imagine it would look like this:
<% if(the div's id above is == with some ReplyToCommentID){ %>
<% } %>
Trying to use document.querySelector in a <%= or <% - %> or script tag results in an error.
Submitted March 23, 2018 at 05:24PM by khazha88
Comment Here
Reply here which has the same ReplyToCommentID value as the comment div
Submitted March 23, 2018 at 05:24PM by khazha88
Generators and iterators in Javascript for Promise Flow Control
https://ift.tt/2IMLIi3
Submitted March 23, 2018 at 04:32PM by Steeljuice1
Submitted March 23, 2018 at 04:32PM by Steeljuice1
Getting Started With Azure Functions and MongoDB
https://ift.tt/2G6nEoo
Submitted March 23, 2018 at 04:02PM by code_barbarian
Submitted March 23, 2018 at 04:02PM by code_barbarian
Question to Express API response
Hey,I've build an API to post data with express.It is just a query to my DB for now. If I start the query from my web page the query will be on "pending" all the time. It loads, loads and loads. Everything I've sent to update in my db is updated, but for some reasons on my webpage it is still pending.heres some code: router.post('/test/clear', (req, res) => { var sql_test= "UPDATE test SET ? = '' WHERE name = ?"; pool.getConnection((err, con) => { pool.query(sql_test, [db_col, obj.clear.test], function(err, results) { if(err) throw err; else { res.statusCode = 201; res.json(results); } }); con.release(); }); }); I tried to google my problem and tried to solve my problem with sending something back within my "else", but after saving it just shows the json, instead of the webpage. My goal is to not reload the webpage after saving and not having a pending status. Do you know how to fix this problem?
Submitted March 23, 2018 at 03:11PM by oppoi
Submitted March 23, 2018 at 03:11PM by oppoi
Using async/await to write cleaner route handlers
http://ift.tt/2uiEXku
Submitted March 23, 2018 at 01:50PM by Cyberuben
Submitted March 23, 2018 at 01:50PM by Cyberuben
Diego Gonzalez: What is the future of the mobile web, and can we actually compete with native?
http://ift.tt/2FUj54G
Submitted March 23, 2018 at 12:59PM by FrontendNation
Submitted March 23, 2018 at 12:59PM by FrontendNation
Queue up those requests for web scraping!
http://ift.tt/2pBlkP4
Submitted March 23, 2018 at 01:09PM by Steeljuice1
Submitted March 23, 2018 at 01:09PM by Steeljuice1
Build Social Networking website From Scratch Using Node.js
http://ift.tt/2G52Bme
Submitted March 23, 2018 at 11:33AM by udemyfreebies
Submitted March 23, 2018 at 11:33AM by udemyfreebies
Express.js Tutorial: Building RESTful APIs with Node and Express
https://www.youtube.com/watch?v=pKd0Rpw7O48
Submitted March 23, 2018 at 10:52AM by ginger-julia
Submitted March 23, 2018 at 10:52AM by ginger-julia
Thursday, 22 March 2018
Full stack integration testing with node?
Firstly, a couple of things to preface this with. I have asked this before, though not too recently. And I am a Java developer who's a big automated testing fan.I'm trying to work out the best ways, if possible, to perform integration testing of the full system. The goal here is 100% confidence at the end of yarn test the everything works. By "everything" I mean:All unit testsDatabase migrationsDAOs, against a real databaseREST APIs, all the way to the database and backEtcI also want to do all of this with the minimal amount of setup. I'd like it to be yarn install && yarn test, and that does everything necessary. No needing to install databases locally, and configure the build to point to them, and so on. That's not reproducible, and is a huge way to introduce errors.In the Java world, I achieve this using things like http://ift.tt/2aztOAh to run s database server up in-process and test against that. And it works great.My assumption is that the best way to achieve this would be docker. In particular, I've found the dockerode module that I think will let me start and stop containers.Is this the best way to tackle this? Or are there other, easier ways that people use?
Submitted March 22, 2018 at 09:43PM by sazzer
Submitted March 22, 2018 at 09:43PM by sazzer
Announcing a Node.js Snap for Linux Users
http://ift.tt/2GgHEbe
Submitted March 22, 2018 at 10:25PM by _bit
Submitted March 22, 2018 at 10:25PM by _bit
Announcing a Node.js Snap for Linux Users
http://ift.tt/2DJNDjn
Submitted March 22, 2018 at 08:44PM by popeydc
Submitted March 22, 2018 at 08:44PM by popeydc
This is the best software development course that I have found on the Internet. While other courses waste lots of time on theoretical concepts, Andrew gets right to the meat of what it means to develop practical apps.
https://twitter.com/StoreCourses/status/976923944866516993
Submitted March 22, 2018 at 08:51PM by angela7walker
Submitted March 22, 2018 at 08:51PM by angela7walker
Sebastian Golasch: Crazy hacks suit IoT just as much as frontend 👾
http://ift.tt/2DNcPFJ
Submitted March 22, 2018 at 07:45PM by FrontendNation
Submitted March 22, 2018 at 07:45PM by FrontendNation
Is there a way to figure out how which topology/ how much power your app will need?(Scaling)
Is there a way to measure how much cpu power your app needs if x amount of people are using it? Assume that there's nothing too fancy and it's a simple CRUD app
Submitted March 22, 2018 at 08:01PM by A4_Ts
Submitted March 22, 2018 at 08:01PM by A4_Ts
How to configure React app with Node backend on Heroku ?
I've created a React app (used CRA) with Node backend for a side project. I followed this tutorial to configure the project. Now I need to host it on Heroku. I'm having some issues with hosting.I usedconst port = process.env.PORT || 5000; as the port in Node server and configured it as proxy in package.json in Client (React App). But how can I serve React App when it's hosting on server ? What should I change in package.json in React app ?
Submitted March 22, 2018 at 06:36PM by sp3co92
Submitted March 22, 2018 at 06:36PM by sp3co92
6 ways to declare JavaScript functions
http://ift.tt/2ywCxw0
Submitted March 22, 2018 at 06:52PM by unquietwiki
Submitted March 22, 2018 at 06:52PM by unquietwiki
Firebird high-level native client for Node.js / TypeScript updated to v0.0.1-beta.1 with a few changes
http://ift.tt/2HUvO3G
Submitted March 22, 2018 at 04:58PM by mariuz
Submitted March 22, 2018 at 04:58PM by mariuz
The madness of NodeJS Promise future
http://ift.tt/2ujvYjp
Submitted March 22, 2018 at 04:29PM by kiarash-irandoust
Submitted March 22, 2018 at 04:29PM by kiarash-irandoust
Deploy a NodeJS App with Heroku
http://ift.tt/2G1gJNo
Submitted March 22, 2018 at 04:44PM by andreapapp
Submitted March 22, 2018 at 04:44PM by andreapapp
A dependency-free promise wrapper around fs
http://ift.tt/2DMKr6K
Submitted March 22, 2018 at 01:52PM by here-for-karma
Submitted March 22, 2018 at 01:52PM by here-for-karma
Noderize - Create a Node app in less than 30 seconds
http://ift.tt/2ppWpOB
Submitted March 22, 2018 at 01:58PM by mburakerman
Submitted March 22, 2018 at 01:58PM by mburakerman
Writing reliable & fault-tolerant microservices in Node.js
http://ift.tt/2HXdhUf
Submitted March 22, 2018 at 11:05AM by StarpTech
Submitted March 22, 2018 at 11:05AM by StarpTech
Creating an API with Node.js using GraphQL
http://ift.tt/2pwtsQU
Submitted March 22, 2018 at 10:16AM by monicror
Submitted March 22, 2018 at 10:16AM by monicror
Important Features of Node.js Version 8.0 Release TurboFan & Ignition
http://ift.tt/2sjlcb0
Submitted March 22, 2018 at 09:43AM by AlfredEkka
Submitted March 22, 2018 at 09:43AM by AlfredEkka
🔥sympact - Simple stupid CPU/MEM "Profiler" for your Node.JS snippets.
http://ift.tt/2GPKnWQ
Submitted March 22, 2018 at 09:25AM by simonepri
Submitted March 22, 2018 at 09:25AM by simonepri
sympact - An easy way to calculate the 'impact' of running a task in Node.JS inside your system.
http://ift.tt/2DKAMxF
Submitted March 22, 2018 at 08:12AM by simonepri
Submitted March 22, 2018 at 08:12AM by simonepri
Wednesday, 21 March 2018
March 2018 Security Releases
http://ift.tt/2GPw2cX
Submitted March 22, 2018 at 12:31AM by dwaxe
Submitted March 22, 2018 at 12:31AM by dwaxe
Passport authentication response time padding
Is there a package available to pad the login response time for passport/express applications? Currently I'm open to timing attacks because valid user/bad password is one response time and bad user is another response time. I would have thought there was a middleware to handle this, just having a hard time phrasing my search correctly.
Submitted March 21, 2018 at 11:31PM by 64bitHustler
Submitted March 21, 2018 at 11:31PM by 64bitHustler
Work for free
I dont know where to post this so i decided to post here..If anyone need developer for nodejs i am willing to work for free (i am not expert on nodejs keep that in mind) or if someone like me want to create some apis for fun and work in team feel free to contact me..i am doing this for fun and learning purposeHere is my project that i created http://ift.tt/2DK26Mn this is not appropiate place for this post..you can delete it or move it somewhere else --Thank you
Submitted March 21, 2018 at 11:41PM by jkuzmanovik
Submitted March 21, 2018 at 11:41PM by jkuzmanovik
[Code Review] Need a kind soul to review my first web app for why it's glitching (5-10 minutes)
http://ift.tt/2G2YNBG yall, I'm working on my first personal project nodejs app. Being that it's my first app, I have some problems in my architecture. Right now I'm focused on moving my js functions (which are in my html file) to my functions.js file and linking them up correctly. The other problem is that right now, when I boot up my starter file, app.js, it throws an error because the app expects a query when the user first opens the app. If you type in '?name=bitcoin&num=1' at the end of the preview running application's url, you'll see the app working.If any generous programmer could help me solve these problems I would be so grateful! Been wrestling with this on and off over the past month.
Submitted March 21, 2018 at 08:14PM by BrakeGliffin
Submitted March 21, 2018 at 08:14PM by BrakeGliffin
Solid, practical course that covers all Node, Express, and MongoDB principles and prepares you to build more apps on your own.
http://ift.tt/2IIzXsE
Submitted March 21, 2018 at 07:03PM by jack7sparrow
Submitted March 21, 2018 at 07:03PM by jack7sparrow
Issues setting authentication headers
So, I'm super new to authentication. I've an app that's built off of a premade user system (frame). They gave me everything except how to authenticate correctly.I need to set the authorization headers, but I can't figure out what that is or how to do it. I've gotten as far as getting the header (in "Basic (random string of text)" form), I just can't figure out what I'm supposed to do with that.Any help is appreciated.
Submitted March 21, 2018 at 06:19PM by ActualyIzDolan
Submitted March 21, 2018 at 06:19PM by ActualyIzDolan
I need some help getting CI/CD working with my new todomvc example app, how can I automate my deployment processes using gitlab ci/cd?
Alright so I have a SailsJs 0.12 app that I am writing right now which will be containerized to help me learn about dockerized nodejs apps and a more automated workflow for CI/CD.Traditionally, i was using codeship that had ssh keys stored, and given a successful test, it would ssh into the production server, cd to the apps directory, git pull, then restart the nodejs app via pm2.Now that I am going to dockerized setup with this new example app, I am not sure how to go about automating the workflow.I am using gitlab-ee with gitlab-runners running so it spins up a docker container for each trigger.Right now I have the following separate containers in a docker-compose.yml:MySQLRedisSailsJs 0.12 running on node 9.5.0nginx - handles reverse proxy of the sails app, and eventual host for the React SPA codeMy gitlab-ci.yml right now is setup for the sails app to simply run yarn install && yarn run test off of the sails app's latest code.I imagine the workflow would be something like this...hack away, boom! code is now ready for 1.0push code to masterpipeline gets triggered in gitlab to test, build, then deployI got the testing part working, its pretty simple gitlab just runs yarn run test off the last commitafter all the tests pass, is where I start to get lost. I imagine with docker containers you just need to build a new image with a new tag (tag latest, or tag v1.0?)git clone the repo (is this even needed?) or can i just skip to docker buildrun docker build . -t todomvc-api:latestrun docker push registry.example.com/ndboost/todomvc-api:latestThe other part I am also confused about is the deploy part, how do i get my production server to pull the new image once its built? Do i need to ssh into the host to trigger the docker commands and restart the container with the new image? Or will something like v2tec/watchtower that would detect the push to registry.example.com for my todomvc-api image and then pull it and restart the container automatically?
Submitted March 21, 2018 at 06:03PM by ndboost
Submitted March 21, 2018 at 06:03PM by ndboost
Node JS: Advanced Concepts
http://ift.tt/2GdEjty
Submitted March 21, 2018 at 05:33PM by sanithaanjk
Submitted March 21, 2018 at 05:33PM by sanithaanjk
Node v9.9.0 (Current)
http://ift.tt/2IGEUlH
Submitted March 21, 2018 at 04:31PM by dwaxe
Submitted March 21, 2018 at 04:31PM by dwaxe
A minimalistic and asynchronous HTTP framework with support for ES modules.
http://ift.tt/2yEAEyv
Submitted March 21, 2018 at 01:58PM by KasperNeist
Submitted March 21, 2018 at 01:58PM by KasperNeist
A quick and easy to use package for Google Cloud BigQuery
http://ift.tt/2FS4Tct
Submitted March 21, 2018 at 01:34PM by indatawetrust
Submitted March 21, 2018 at 01:34PM by indatawetrust
how to populate (mongo) a field on the req.user ?
One field in my User collection looks like this:hearts: [{ type: mongoose.Schema.ObjectId }], I'm trying to populate the objectID so I have access to all the other dataNormally I'm familiar running autopopulate function in mongo:function autopopulate(next) { this.populate("hearts"); next(); } userSchema.pre("find", autopopulate); userSchema.pre("findOne", autopopulate); But because the object is on the req.user, I'm not using "find" or "findOne" in my controller. I'm just passing req.user directly into my views.Massive thanks for any help!
Submitted March 21, 2018 at 02:01PM by harrydry
Submitted March 21, 2018 at 02:01PM by harrydry
Narro API:: message: 'Unauthorized'
http://ift.tt/2pu80Mt
Submitted March 21, 2018 at 01:04PM by RenjithVR4
Submitted March 21, 2018 at 01:04PM by RenjithVR4
Release Strapi v3@alpha.11 - File Upload
http://ift.tt/2HTV36l
Submitted March 21, 2018 at 12:52PM by pierreburgy
Submitted March 21, 2018 at 12:52PM by pierreburgy
Cannot get route when deployed to heroku
Hello everyone,I'm pretty new to Nodejs and this is probably a very noobish mistake. I already described the problem in the github repo of the setup i'm using, but haven't gotten any responses so far...Any input you guys can give me either here or as a response to me issue will be most welcome. Let me know if you need any other info about my config.
Submitted March 21, 2018 at 10:56AM by fatgirlstakingdumps
Submitted March 21, 2018 at 10:56AM by fatgirlstakingdumps
NodeJS Security: Development
http://ift.tt/2puqlsZ
Submitted March 21, 2018 at 09:55AM by andreapapp
Submitted March 21, 2018 at 09:55AM by andreapapp
A Blog App on Google Datastore
http://ift.tt/2IHfzIi
Submitted March 21, 2018 at 09:10AM by sebelga
Submitted March 21, 2018 at 09:10AM by sebelga
Tuesday, 20 March 2018
Build a Referral System in Node-Express and Postgres
http://ift.tt/2pp6qLG
Submitted March 20, 2018 at 11:58PM by kiarash-irandoust
Submitted March 20, 2018 at 11:58PM by kiarash-irandoust
Need to Node - Volume 5
http://ift.tt/2DFsQ0k
Submitted March 20, 2018 at 08:27PM by _bit
Submitted March 20, 2018 at 08:27PM by _bit
Serving images from an express app to a frontend.
Hi,I am building a little VUE.js app and using a decoupled NODE.js/Express backend.I have a user profile where the user can upload images, which I achieve with Multer.This works great but now I need to server those images, currently I am making a request to get the users details and then I also get the path to the image but the problem is that the client is served on http://localhost:8080/ whilst my Restful API runs on http://localhost:8081.Any idea how I can actually serve the image on my front end?I can do a fetch request to the absolute url and then convert the file to base64 but does not feel like the right way to go about it.I have my static folder on Express setup, so a get request to the image works but how do I convert that to a usable image url?Thanks!
Submitted March 20, 2018 at 08:28PM by sieg_webdev
Submitted March 20, 2018 at 08:28PM by sieg_webdev
Patterns — Generic Repository with Typescript and Node.js
http://ift.tt/2FXBTM4
Submitted March 20, 2018 at 07:19PM by erickwendel
Submitted March 20, 2018 at 07:19PM by erickwendel
Deploy App to Production
I have an “App” I’ve written with a backend API in Express and frontend in React.I wondered how to deploy this to a normal server rather than Heroku and how to do this with say TravisCIThe idea I have is to use PM2 to run the index.js for both client and server? Will this work?Is there a better way to do this?
Submitted March 20, 2018 at 07:23PM by BrightonTechie
Submitted March 20, 2018 at 07:23PM by BrightonTechie
Make your GraphQL API Easier To Adopt Through Components
http://ift.tt/2u8dMce
Submitted March 20, 2018 at 06:43PM by JSislife
Submitted March 20, 2018 at 06:43PM by JSislife
pidtree - 🚸Cross platform children list of a PID. [Testers Appreciated]
http://ift.tt/2IB35lE
Submitted March 20, 2018 at 04:49PM by simonepri
Submitted March 20, 2018 at 04:49PM by simonepri
How To Control Your Tesla With Profound.js
https://m.youtube.com/watch?v=mANP56aKIwM
Submitted March 20, 2018 at 12:17PM by fagnerbrack
Submitted March 20, 2018 at 12:17PM by fagnerbrack
Updating data in my database without reloading the page from EJS
I am creating something like the reddit comment section, someone can comment something and people can reply to that comment.I am using Node, Express, MySQL, EJS.The problem: I don't know how to make the upvote/downvote part, I don't know how to make an onclick event which will tell my DB to upvote/downvote that comment by 1 without reloading the page.Express code: app.get("/posts", function(req,res){ connection.query(`SELECT post FROM testingposts`, function(error,result){ if(error){ console.log(`error 757`) } else { console.log(`works btw`) res.render("posts", {result: result }) } }) }) app.post("/posts", function(req,res){ let post = req.body.post; console.log(`req.body`) console.log(req.body.theValue) connection.query(`INSERT INTO testingposts(post) VALUES(?)`, [req.body.post], function(error,result){ if(error){ console.log(`error 555`) } else { res.redirect("/posts") } }) }) EJS: //This part basically creates the html elements for the comments. //But I haven't added the upvote/downvote elements yet. <% for(let i = 0; i < result.length; i++){ %>
<% } %>I tried trying something with Fetch, but it didn't work properly for me.(I don't know what to write as the URL)
Submitted March 20, 2018 at 10:49AM by khazha88
<%= result[i].post %>
Submitted March 20, 2018 at 10:49AM by khazha88
Node 8.10.0 Comes to StdLib, Ship APIs With Faster Deployments and New Community Features
http://ift.tt/2HQ2mvP
Submitted March 20, 2018 at 08:13AM by keithwhor
Submitted March 20, 2018 at 08:13AM by keithwhor
Is there a downside to using template literal strings everywhere?
I keep accidentally using them for strings that do not require string templating, sighing and then removing them and using single quotes.Since ESLint doesn't seem to care that i am using them without string templates (or atleast i cannot find a rule for that). Is there any downside of just completely moving over?
Submitted March 20, 2018 at 07:50AM by SonOfSpades
Submitted March 20, 2018 at 07:50AM by SonOfSpades
Help with Google service account auth (Invalid JWT Signature)
Good day /r/nodeI am currently struggling with an error with regards to getting an auth token from Google using the >googleapis node module.I keep receiving the following error:invalid_grant: Invalid JWT Signature.I have created the service account and granted it all permissions in the google developer console. I have enabled the analytics API that I am trying to access as well.This is the code:let { google } = require('googleapis'); let privatekey = require('../config/keys/CCKey.json'); let jwtClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, 'http://ift.tt/15Q8qQj', null ); //authenticate request jwtClient.authorize(function (err, tokens) { if (err) { console.log(err); return; } else { console.log(tokens); } }); The json file was generated when creating the service account, I honestly don't know what to try anymore. Have been trying to figure this out for 5-6 hours.Does anyone possibly have any idea why I am getting this error?
Submitted March 20, 2018 at 06:52AM by thezadmin
Submitted March 20, 2018 at 06:52AM by thezadmin
Monday, 19 March 2018
When you run out of disk space
http://ift.tt/2DG0Vxg
Submitted March 19, 2018 at 10:17PM by Lamproie
Submitted March 19, 2018 at 10:17PM by Lamproie
What technology/language/framework should I use?
Hi! I am a beginner in programming and I have an idea of building an audiobook platform or web app for my place where I live. Now I know basics of HTML, CSS, PHP (got basics of oop covered, know a bit about mvc frameworks, still not as good as I think a php dev should be). I am in 9th grade (lol) so I am not in any kind of hurry. I want to learn most flexible and scaleable but fast but good but friendly language (I know that that doesn't exist).So I would like to add secured audio files to a server so people can listen to it but so they can't easily steal my stuff. Thinking about PWA app (I am a big thinker) but you'll get me confused if you said anything about some function systems compiling custom frameworks 'n stuff (just kidding). Thats why I need learning paths not a specific coding practice guide.The most simple question: "What to learn after I finish 'mastering' PHP? Should I use it or implement it with javascript or am I too ambitious?"
Submitted March 19, 2018 at 06:54PM by UnDefinedDEVELOPER
Submitted March 19, 2018 at 06:54PM by UnDefinedDEVELOPER
Call GraphQL API with Native Node Modules
http://ift.tt/2FTlqZp
Submitted March 19, 2018 at 03:27PM by kiarash-irandoust
Submitted March 19, 2018 at 03:27PM by kiarash-irandoust
crypto-hash - Hashing with the same API in Node.js and the browser
http://ift.tt/2FBGsyG
Submitted March 19, 2018 at 06:34PM by sindresorhus
Submitted March 19, 2018 at 06:34PM by sindresorhus
How We Effectively Share And “Reuse” Code Between Microservices At Scale
http://ift.tt/2pqzao8
Submitted March 19, 2018 at 04:22PM by JoniSar
Submitted March 19, 2018 at 04:22PM by JoniSar
res.write spanning multiple functions?
I am trying to display domain searching results from a user-search. The flow of the application is:The user make a search (could be stackoverflow.com).The application returns a result from that search.In the background the application keeps searching for other domains and displays the results when they are ready.I am using Express in Node.js and from what I understand, it would be possible using res.write() and finish it with a res.end(). However, with my current setup I just get a "Write after end" error.I assume it's due to Javascript asynchronous nature, but I am a new developer, so that would just be my guess.This is my code pre-res.write. How would I rewrite it the best possible way, to create a res.write stream?router.get("/new", function(req, res) { //Strip all subdomains - the post var now only contains the domain and TLD. var post = getDomain(req.query.id); //Check if the user inserts a valid TLD. if (!tldExists(post)) { return res.send(JSON.stringify("invalidTld")); } //I want to replace every res.send with res.write after this comment functions.singleDomain(parse(req.query.id).hostname) .then(function(value) { res.send(JSON.stringify(value)); }) .catch(function(error) { res.send(JSON.stringify(error)); }) functions.checkDB(post) //Check if domain has been resolved within the last 24 hours. .then(function(value) { let promise; if(value !== false) { console.log("Domain has been resolved within the last 24 hours"); return res.send(JSON.stringify(value)); } else { promise = functions.lookupDomain(post); } return promise; }) .then(function(value) { res.send(JSON.stringify(value)); }) .catch(function(error) { console.log(error); }) });
Submitted March 19, 2018 at 04:35PM by HumbleBobcat
Submitted March 19, 2018 at 04:35PM by HumbleBobcat
Resizing Images in Node.js using Express & Sharp
http://ift.tt/2G5mNHF
Submitted March 19, 2018 at 03:47PM by malcoded
Submitted March 19, 2018 at 03:47PM by malcoded
Best practice for adding "notifications" to a site?
I'm making a dating site.Imagine James "hearts" Sally's profile. I want a simple notification for Sally next time she logs in. Kinda like facebook.My current idea is having both:{"hearts": [james, fred, george]} {"newHearts": [james]}objects in the users mongo database. And every time an item gets added to hearts it also gets added to newHearts. Then when a user acknowledges the "newHeart" i remove the item and the array is empty again?I've never done notifications before so wasn't sure there is a best practice? Bear in mind I also want to add in similar notifications for messaging later. So may be worth considering that. Thank you for any help!
Submitted March 19, 2018 at 02:08PM by harrydry
Submitted March 19, 2018 at 02:08PM by harrydry
[x-post] Library or tool for extracting product data from product pages?
http://ift.tt/2pmYRGk
Submitted March 19, 2018 at 02:24PM by mvalen122
Submitted March 19, 2018 at 02:24PM by mvalen122
Help needed to write authentication and authorization micro service.
I am writing my first production level Node application and want someone to have a look at my current code and guide me in the right direction.Source
Submitted March 19, 2018 at 12:11PM by b_curious
Submitted March 19, 2018 at 12:11PM by b_curious
Making Music from Data with Node.js (Scribbletune)
http://ift.tt/2FVWbWi
Submitted March 19, 2018 at 12:37PM by moklick
Submitted March 19, 2018 at 12:37PM by moklick
Top JavaScript Articles of the Week — React Context, Authentication, Node, Performance Tips, Neural Networks and More
http://ift.tt/2pos4kl
Submitted March 19, 2018 at 11:13AM by treyhuffine
Submitted March 19, 2018 at 11:13AM by treyhuffine
Promise.all() and Readline problem. Need help.
I've been working with NodeJS a lot lately – I'm creating an assistant to help manage Bitbucket repositories, initiate new projects cloning the main template and stuff like that.So, I created a function to get information from the user. You pass the question as a parameter, the function uses readline to get the information and returns a Promise – resolved with the answer and rejected if nothing was typed.Most of the time I need more than just one information, so I'm using Promise.all() with all the questions I need to ask. The problem is: as long as the user answers the first question, the program just stops. I tried using rl.close() everywhere but it just doesn't work. Although it works if I chain the functions like ask(question).then(ask(question).then(ask(question).then...)).On the actual function I'll be handling errors way better than this, but here's an example:function ask(question) { return new Promise((resolve, reject) => { rl.question(question, (answer) => { if (answer.length === 0) reject() resolve(answer) }) }) } Promise.all([ ask('Username:'), ask('Email:'), ask('Client Key:'), ask('Client Secret:') ]).then((data) => { console.log(data); }).catch(() => { console.log("Something got lost."); }) Also, if it helps, I'm asking a simple YES or NO question before this chain – "You need to setup your Bitbucket account first. Do you feel like doing that now? [Y/n]" – But I've already tested it without this question and it still doesn't work.Can anyone tell me what I'm doing wrong?
Submitted March 19, 2018 at 11:45AM by grasfahrer
Submitted March 19, 2018 at 11:45AM by grasfahrer
Simple cryptocurrency trading data preparation in 15 minutes using MS Azure and Google Colab
http://ift.tt/2pmWG4A
Submitted March 19, 2018 at 10:49AM by andreapapp
Submitted March 19, 2018 at 10:49AM by andreapapp
IOT project - tips & advice
starting an IOT project now with Node.JS - devices stream data in, backend should enrich before saving, identify patterns and signal back to the devices. Would appreciate any tip/insight/package/practice/pattern you learned in a similar project
Submitted March 19, 2018 at 10:50AM by yonatannn
Submitted March 19, 2018 at 10:50AM by yonatannn
Building a twitter bot for posting the latest package releases on Github
http://ift.tt/2FTLGTw
Submitted March 19, 2018 at 08:56AM by qawemlilo
Submitted March 19, 2018 at 08:56AM by qawemlilo
Do not use Node.js optimization flags blindly
http://ift.tt/2HKHtlA
Submitted March 19, 2018 at 09:21AM by SnirD
Submitted March 19, 2018 at 09:21AM by SnirD
The inception of ESLint
http://ift.tt/2Cp3iZs
Submitted March 19, 2018 at 09:01AM by fagnerbrack
Submitted March 19, 2018 at 09:01AM by fagnerbrack
Sunday, 18 March 2018
[Help] How do libraries like material-ui achieve this sort of module pathing?
I am building a React library, and I'm to the point where I want to start figuring out how the developer experience is going to go. I really like how libraries like material-ui and react-bootstrap let you pull directly from a path, rather than deconstructing (though I'm sure this isn't that big of an issue).Pathing in question:import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'So, I've gone through material-ui's github, and I've gone through their npm module once it is installed and I see essentially how it is happening. They have each individual file/folder in the root of the project. That's cool and all, but I can't seem to find anything in their build/publish process that would dictate that this sort of folder structure should be generated. Does anyone have any ideas on how I could achieve this?
Submitted March 19, 2018 at 01:44AM by ChubsTheBear
Submitted March 19, 2018 at 01:44AM by ChubsTheBear
Learning Promises and Reduce, Map Functions Cut My Code In Half
I've been a web developer since I was a teenager, and I started learning node last year to build a cloud-based data platform on GCP. Over the last year I've forced myself to start learning about promises... For some reason, this concept took me a long time to "get".Recently, I've started rebuilding some of my essential functions, and comparing my old code, realized how much promises help.All of my code that requires synchronous data transfer and analysis has been cut in half, and way simplified. I used to have these crazy nested recursive functions with callbacks to set off the next event.Now it's just a few basic chained promises. As if cutting the code in 1/2 wasn't enough, reading it is now 10x easier too. Reduce was pretty critical to getting all my arrays of data to process synchronously, which further simplified things.Anyways, if you have not learned promises, reduce, map functions yet, I highly recommend it!Just the gist of what I'm talking aboutlet myArray = ["beans", "soup", "peanuts", "artichokes"]; myArray.reduce((promise, item) => { return promise.then(() => { return itemsPromise(item); }); }, Promise.resolve()).then(() => { console.log("ALL DONE"); }) let itemsPromise = (item) => { console.log("Item: ", item); return new Promise((resolve, reject) => { setTimeout(() => { resolve(); }, 2000); }); } I'm really excited about this!!
Submitted March 18, 2018 at 11:43PM by boon4376
Submitted March 18, 2018 at 11:43PM by boon4376
The most "what the f*ck did I just watch?" node.js related video.
https://www.youtube.com/watch?v=g59cGn6xmLo
Submitted March 18, 2018 at 09:51PM by JavascriptFanboy
Submitted March 18, 2018 at 09:51PM by JavascriptFanboy
async/await and parallelizing - first post on medium 🎊🎉
http://ift.tt/2pnffG1
Submitted March 18, 2018 at 09:37PM by puemos
Submitted March 18, 2018 at 09:37PM by puemos
[Help]change password in nodejs, mongoDB with passport
http://ift.tt/2FKZWSm
Submitted March 18, 2018 at 08:13PM by footballbloodyhell
Submitted March 18, 2018 at 08:13PM by footballbloodyhell
Module somehow not receiving variable
Hi, I have this weather forecast app where the weather is retrieved based on the users location.However, there is this strange behaviour where if I pass in my hard coded ip address to the line where.is('87.92.111.226', function(err, result) { I get the correct result, but if I pass the variable ipAddress, the node-where module fails to find the location details. The strange part is, if I res.send(ipAddress); the ipAddress just before that line, it outputs my ip address, so the ip address should be passed to that line. How come it's failing? Thanks.const express = require('express'); const app = express(); const request = require('request'); const where = require('node-where'); // Callback that ends the process *when* the response is sent const endSuccess = () => process.exit(0); const apiKey = '********************'; let ipAddress; let city; let weatherForcast; let url; app.get('/!/node-weather', function(req, res) { ipAddress = req.connection.remoteAddress; if (ipAddress.substr(0, 7) == "::ffff:") { ipAddress = ipAddress.substr(7) } if (ipAddress) { // Call node-where module method to get location details from ip address //res.send(ipAddress); where.is(ipAddress, function(err, result) { if (result) { //res.send(result); if(result.get('city')){ city = result.get('city'); } else { res.send("City not found"); } url = `http://ift.tt/2pmJPiR; // Call request module method to query the api request(url, function (err, response, body) { if(err){ res.send('Error:', error); } else { let weather = JSON.parse(body); weatherForcast = `It's ${weather.main.temp} degrees in ${weather.name}!`; res.send("Done: " + weatherForcast); } }); } else { res.send(err); } }); } else { res.send("No IP Address found."); } if (res.headersSent) { res.end('Done', endSuccess); } }) app.listen(parseInt(process.env._2038_PORT), function(e) { if (e) { console.error(e); process.exit(1); } console.log(process.env._2038_READY); });
Submitted March 18, 2018 at 07:16PM by hey__its__me__
Submitted March 18, 2018 at 07:16PM by hey__its__me__
Building Angular and Node api with Bazel
http://ift.tt/2GEZTVH
Submitted March 18, 2018 at 02:26PM by funJS
Submitted March 18, 2018 at 02:26PM by funJS
Nodejs database help
I want make a project to learn more about nodejs. Can you recommend me a tutorial for a nodejs db and bootstrap for admin?
Submitted March 18, 2018 at 01:45PM by rdc1113
Submitted March 18, 2018 at 01:45PM by rdc1113
🧠I'm building Léon, an open-source personal assistant. Based on Node.js , Python and machine learning for his NLU.
http://ift.tt/2pq11Eu
Submitted March 18, 2018 at 01:08PM by Louistiti
Submitted March 18, 2018 at 01:08PM by Louistiti
How to run this package script with yarn?
Im following a online course that uses this github repo http://ift.tt/2FJOwhV using "npm run dev" everything works as expected, starts a server builds a react app. But if I change all the npm's to yarn and run "yarn run dev" the server tries to start multiple times and doesnt do anything about reactThe course I'm learning is more about the backend rather than the react side, so I dont know much about building react apps, but can someone explain how npm run dev behaves different, and expected, when compared to yarn run dev, which fails to work. And also what do I need to do to make yarn run dev work?
Submitted March 18, 2018 at 10:52AM by itsmoirob
Submitted March 18, 2018 at 10:52AM by itsmoirob
Fabulously kill processes. Cross-platform.
http://ift.tt/1JaZGr5
Submitted March 18, 2018 at 06:40AM by ratancs
Submitted March 18, 2018 at 06:40AM by ratancs
I’ve noticed in my area 90 % of react shops use node for their backend, is this coincidence or does react work better with node on the backend than things like django/other frameworks?
My goals is to get a job in react as a front end developer, noticing so many react shops use node, I have 3 questions.1) does react work better with node given the amount react shops I see using node ?2) since most of you are probably backend developers on this forum, do you think as a front end developer learning some node would benefit me in being a more competitive candidate for a react dev. Since some of you probably work with react devs and know if they interact with node at any level , what’s your opinion?3) as someone completely new to backend , I’ve heard I should start would django first , even if I want to learn node because django has “batteries built in” and it should set up my understanding of backend faster than if i tried to learn node first.Many thanks!!
Submitted March 18, 2018 at 07:48AM by tony2times3
Submitted March 18, 2018 at 07:48AM by tony2times3
Saturday, 17 March 2018
How to build Node.js in TFS?
I know next to nothing about Node.js, but need to setup builds in TFS for a new project that is using it. All the top results when I search are using gulp.js, but our local build instructions don't use it. I do have experience setting up builds, so I'm really just looking for what do I use to build it, etc.Can someone give me a simple run down?The developers instructions are pretty basic:Install Node.js Run the Node.js command prompt Install angular/cli install npm packages defined in project run "ng build" to build the project. Deploy output.(I posted this in r/tfs but didn't get any responses)
Submitted March 18, 2018 at 01:52AM by V6F
Submitted March 18, 2018 at 01:52AM by V6F
This is exactly I needed for the level where I am at. It is covering all basics (and advanced features) of Node, Express, Mocha, testing of JS scripts, MongoDB, Mongoose, APIs, new Javascript ES6 features including promises and arrow functions and lot more. Andrew is an excellent teacher.
http://ift.tt/2EEdKxK
Submitted March 17, 2018 at 09:40PM by jack7sparrow
Submitted March 17, 2018 at 09:40PM by jack7sparrow
How do I approach testing?
So I've built a small CRUD application and wanted to write some tests for it, but don't know what exactly to test.Most of my code is just calling the database, communicating with APIs, or just validating input from the client. What exactly should I test here? Should I put fake information into the database? Should I mock calls to AWS? Thanks in advance.
Submitted March 17, 2018 at 07:25PM by allvoid
Submitted March 17, 2018 at 07:25PM by allvoid
uws binary is not loading but it's there!
Hi there! My nodejs-fu is quite weak so my question could be absolutely inappropriate. I've receiveing this error, that binary is not found, bit it's there! I've added a line that spits out a binary name it's looking for, see in the log. What could be wrong here?[mastodon@server live]$ ls node_modules/uws/ binding.gyp LICENSE uws_darwin_46.node uws_darwin_51.node uws.js uws_linux_48.node uws_win32_51.node build package.json uws_darwin_47.node uws_darwin_57.node uws_linux_46.node uws_linux_51.node uws_linux_59.node uws_win32_57.node build_log.txt src uws_darwin_48.node uws_darwin_59.node uws_linux_47.node uws_linux_57.node uws_win32_48.node uws_win32_59.node [mastodon@server live]$ NODE_ENV=production /usr/bin/npm run start > mastodon@ start /home/mastodon/live > node ./streaming/index.js MODULE TO LOOKUP: ./uws_linux_59 /home/mastodon/live/node_modules/uws/uws.js:39 throw new Error('Compilation of µWebSockets has failed and there is no pre-compiled binary ' +
Submitted March 17, 2018 at 05:49PM by Sprnza
Submitted March 17, 2018 at 05:49PM by Sprnza
My Discord bot that connects to a mySQL server randomly crashes over a 24 hour period with Error: read ECONNRESET. Anyone know a fix?
From what I've read I need a handler to reconnect when the error is thrown. Unfortunately I'm really new to Node and I need some help with making a handler.The full error is:events.js:183 throw er; // Unhandled 'error' event ^ Error: read ECONNRESET at _errnoException (util.js:1024:11) at TCP.onread (net.js:615:25)
Submitted March 17, 2018 at 06:11PM by Brinstakilla
Submitted March 17, 2018 at 06:11PM by Brinstakilla
SpeakJS – A Discord server for all things JavaScript (with ~4000 members)
http://ift.tt/2eF1tra
Submitted March 17, 2018 at 12:44PM by speakJS
Submitted March 17, 2018 at 12:44PM by speakJS
Nodejs google analytics clone library
I'm searching for opensource library that has the basic functionality of google analytics. Tipically collect access logs data for a single entry URL and makes some graphs using highcharts or similar js library:per time visit (hour in day, day in week, month in year etc)per OS visit (android, ios, etc)location from visit (with maps or list of countries/cities)
Submitted March 17, 2018 at 09:30AM by hadokee
Submitted March 17, 2018 at 09:30AM by hadokee
Friday, 16 March 2018
Best way to store a value that is rapidly updated.
I have always had a super silly idea to have a webpage with a single button that when clicked would update the global value for times the button has been over all time. Storing the value in a database would not be good because of how fast it would have to be updated for everyone clicking the button multiple times per second, so how else could this be achieved. I’m just curious.
Submitted March 16, 2018 at 10:12PM by mrchriswindsor
Submitted March 16, 2018 at 10:12PM by mrchriswindsor
Single Link Clustering with Node.js
http://ift.tt/2pkoNlf
Submitted March 16, 2018 at 10:16PM by code_barbarian
Submitted March 16, 2018 at 10:16PM by code_barbarian
[ASK] About NodeJS MongoDB reconnecting with EventEmitter
So this is what i do.mediator.emit('mongo.start');it will be caught by mediator.on('mongo.start') then mongodb will try to connect, and when it fail, it will emit('mongo.error')it will be caught by mediator.on('mongo.error, () => mediator.emit('mongo.start'))the problem is, when i try to this with my mongodb service turned off, it didn't do what i expected it to do. It supposed to reconnect to mongodb until it succeeds right ?? do i understand things incorrectly ?what do you usually do to handle mongodb connection failure ??thanks in advance.
Submitted March 16, 2018 at 09:05PM by StupidRandomGuy
Submitted March 16, 2018 at 09:05PM by StupidRandomGuy
I made a command-line tool to send emails, in node.js. Feedback appreciated
Hey guys,I was in need of a unix-style command line tool that simply sends all the piped standard input via e-mail using an external SMTP server.I've decided to write it myself, and it's the first package I publish on npm.Have a look here 👇http://ift.tt/2IwSXu4 feedback is appreciated.If someone would find it useful, I might write a few blog posts to show the steps from simple script to full module published on npm.Cheers
Submitted March 16, 2018 at 05:53PM by misterolupo
Submitted March 16, 2018 at 05:53PM by misterolupo
[Question] What to use for a dynamically refreshed list
I am implementing a twiter like application and I don't know what to use for the following scenario : A user posts a message on the main page. Other users should see this update without refreshing the page, and without the whole page having to refresh. If there are too many messages on the main page, the user only sees 25, then more are displayed if he scrolls down. I'm not asking for the entire code, just the packages I can use.
Submitted March 16, 2018 at 11:59AM by redblood252
Submitted March 16, 2018 at 11:59AM by redblood252
Node.js Top 10 Articles for the Past Month-v.Mar 2018
http://ift.tt/2GykNWq
Submitted March 16, 2018 at 12:55PM by kumeralex
Submitted March 16, 2018 at 12:55PM by kumeralex
Angular 2(or 4) and NodeJS-The Complete Guide to MEAN Stack
http://ift.tt/2uC9r0Q
Submitted March 16, 2018 at 10:41AM by babyfase
Submitted March 16, 2018 at 10:41AM by babyfase
Learn tricky parts of JavaScript especially for interviews
http://ift.tt/2zeezps
Submitted March 16, 2018 at 10:29AM by GamesMint
Submitted March 16, 2018 at 10:29AM by GamesMint
A video introduction of Pandora.js
http://ift.tt/2FWNVc6
Submitted March 16, 2018 at 09:49AM by guangwong
Submitted March 16, 2018 at 09:49AM by guangwong
Strategic Initiatives from the Node.js Project
http://ift.tt/2t9Vffd
Submitted March 16, 2018 at 08:30AM by fagnerbrack
Submitted March 16, 2018 at 08:30AM by fagnerbrack
A simple util to make rollback easy in complex nested promises.
http://ift.tt/2piBOwc
Submitted March 16, 2018 at 08:36AM by PriyankBht
Submitted March 16, 2018 at 08:36AM by PriyankBht
Web Scraping with Node.js
https://www.youtube.com/watch?v=eUYMiztBEdY
Submitted March 16, 2018 at 08:26AM by ms-maria-ma
Submitted March 16, 2018 at 08:26AM by ms-maria-ma
Thursday, 15 March 2018
The Most Convoluted JavaScript Fizz Buzz Solution
http://ift.tt/2HBUBt5
Submitted March 15, 2018 at 11:30PM by dalejefferson
Submitted March 15, 2018 at 11:30PM by dalejefferson
Let's fix the good old command line
http://ift.tt/2GvJvGT
Submitted March 15, 2018 at 09:56PM by mvila
Submitted March 15, 2018 at 09:56PM by mvila
Reddit image collection tool
http://ift.tt/2pdNT54
Submitted March 15, 2018 at 10:10PM by indatawetrust
Submitted March 15, 2018 at 10:10PM by indatawetrust
Speedo CLI - Internet speed report in your terminal
http://ift.tt/2FCySnN
Submitted March 15, 2018 at 09:21PM by xxczaki
Submitted March 15, 2018 at 09:21PM by xxczaki
Client and server side communication with Node?
Hello all,I'm a ruby dev who does a lot of work with JavaScript. There have been so many times where it would have made my life a tad bit simpler if I could use JavaScript to communicate with the server in a Rails app.I'm wondering if Node has this capability. If so, I'm switching today.So to be clear: If I create a variable in Javascript, inside of a
Control the macOS `Do Not Disturb` feature
http://ift.tt/2Hnfpo2
Submitted March 15, 2018 at 05:33PM by sindresorhus
Submitted March 15, 2018 at 05:33PM by sindresorhus
Building an app that requires sending browser notifications when client's not connected to site?
I'm trying to build an app that delivers real time information about an event through browser notifications.I thought I'd use socket.io to do this, but the connection closes when a user exits the site. I want to be able to send a notification even when a user isn't connected to the page. I know this is possible, but not sure where or what I'm looking for. Can anyone help?
Submitted March 15, 2018 at 03:44PM by PM_ME_DON_CHEADLE
Submitted March 15, 2018 at 03:44PM by PM_ME_DON_CHEADLE
Noderize: Create Node apps in 30 seconds
http://ift.tt/2tUTWkO
Submitted March 15, 2018 at 04:20PM by CraftThatBlock
Submitted March 15, 2018 at 04:20PM by CraftThatBlock
I am creating a "switch" in nodejs. Please help.
I am creating a "switch" in nodejs. The job of the switch is simple. Client will send it a payload through a post request and this "switch" will send that payload to another server (which will respond asynchronously) by making a post request using request module. Simple stuff.Now the catch here is that the incoming traffic will be HUGE. I have never done such thing on such a scale in past. Just wrote simple nodejs backends for few users. I would be grateful if someone could help me on what are the other things that I need to keep in mind like encryption, encoding? Other things? Any open source project where I can look? Any input is greatly appreciated.
Submitted March 15, 2018 at 12:19PM by sangupta637
Submitted March 15, 2018 at 12:19PM by sangupta637
The Headache and Heartache of Unhandled Rejections
http://ift.tt/2HxPnP9
Submitted March 15, 2018 at 01:48PM by petecorey
Submitted March 15, 2018 at 01:48PM by petecorey
How can I send a JSON object which also has a File object through a POST request?
I posted a StackOverflow question about it.But basically, I have an object like this:const people = { admin: { adminName: 'john', avatar: { img: File } }, moderator: { modName: 'jake', avatar: { img: File } } }; The img property is just a File object. I'm basically trying to send this object to my Node server in a POST request.Here is what I tried:client.jslet formData = new FormData(); formData.append('admin-name', people.admin.adminName); formData.append('admin-avatar', people.admin.avatar.img); formData.append('moderator-name', people.moderator.modName); formData.append('moderator-avatar', people.moderator.avatar.img); fetch('/submit', { method: 'POST', body: formData }) server.jsimport formidable from 'express-formidable'; router.use('/submit', formidable()); router.post('/submit', (req, res) => { console.log(req.files); // This contains the Files objects console.log(req.fields); // This has the rest of the data res.end(); }); Server Output{ 'admin-avatar': File {}, 'moderator-avatar': File {} } { 'admin-name': 'john', 'moderator-name': 'jake' } The problem with this approach is that I have to manually append each field, which isn't really feasible for a larger object. Also, I'm not crazy about the fact that the admin values are not grouped together anymore in the server-side, as well as the moderator values.Is there a better way to do this?
Submitted March 15, 2018 at 11:12AM by inhwjs
Submitted March 15, 2018 at 11:12AM by inhwjs
What's you favorite node boilerplate ?
I use pretty often express generator which is decent, but I was wondering what other node boilerplate are popular ?
Submitted March 15, 2018 at 10:01AM by OogieFrenchieBoogie
Submitted March 15, 2018 at 10:01AM by OogieFrenchieBoogie
Moleculer - Fast & powerful microservices framework for NodeJS
http://ift.tt/2vXGICC
Submitted March 15, 2018 at 08:56AM by harlampi
Submitted March 15, 2018 at 08:56AM by harlampi
Wednesday, 14 March 2018
Searching for username not in database [postgresql,nodejs,passportjs]
http://ift.tt/2FWSX8q whenever I run my program and try login in heres what happens: -It logs me in if my username is in the database and the password to that username is correct.(So the program works in this case) -It redirects to /login and doesn't log me in if I put a username in the database but put a incorrect password(so this works aswell) and now here is the problem: -When I insert a username that is NOT in the database and try logging in, the login page loads FOREVER I tried to put a console.log message everywhere and It doesn't console.log anything anywhere the page just loads forever. Please help thanks in advance
Submitted March 14, 2018 at 11:52PM by PseudoProgrmmer
Submitted March 14, 2018 at 11:52PM by PseudoProgrmmer
when a company asks for expert knowledge with nodejs, what exactly do they mean?
i've been learning a bit of nodejs doing mostly web apps with expressjs. i want to try to switch from front end to backend using nodejs since i already know some js. when a company asks for expert knowledge with nodejs, what specific skills are they looking for? what should i be able to do with nodejs in a production environment?thanks
Submitted March 14, 2018 at 10:14PM by desperate-1
Submitted March 14, 2018 at 10:14PM by desperate-1
Should I learn vanilla Node first
Hey everyone, Sorry in advance if this isn't a very good question. I just started learning Node and was wondering how long I should spend learning the basics of vanilla node to, for example , create a server and serve some HTML pages before I move on to using frameworks like express,require,etc.
Submitted March 14, 2018 at 08:32PM by Jimc26x
Submitted March 14, 2018 at 08:32PM by Jimc26x
The Complete Guide to Node.js Developer Course by Rob Percival
http://ift.tt/2uSMogH
Submitted March 14, 2018 at 12:15PM by babyfase
Submitted March 14, 2018 at 12:15PM by babyfase
First-class Twig engine for Node.js written in Typescript
http://ift.tt/2tMNI69
Submitted March 14, 2018 at 10:27AM by blacksonic86
Submitted March 14, 2018 at 10:27AM by blacksonic86
Tuesday, 13 March 2018
Is there a way to monitor the event loop in node.js?
I am trying to get access to the event loop and get the names and the order of functions that are enqueue. I'm looking for resources beyond what the chrome dev tools provide. I'm currently looking through the node source code but am not sure where to start.I have found information on the resident set - would that be helpful in finding the information I'm looking for? Is it even possible to access information from there?
Submitted March 14, 2018 at 12:00AM by pjr4lph
Submitted March 14, 2018 at 12:00AM by pjr4lph
typescript-starter CLI: generate a Node.js typescript project and start hacking in 1 minute (popular tooling pre-configured)
http://ift.tt/2p9m9PP
Submitted March 13, 2018 at 11:51PM by bitjson
Submitted March 13, 2018 at 11:51PM by bitjson
Creating a microservice in NodeJs
http://ift.tt/2nM2gOk
Submitted March 13, 2018 at 10:50PM by funJS
Submitted March 13, 2018 at 10:50PM by funJS
What's the best way to go about implementing Google's pagerank algorithm in node?
The source code is available on github in java, python, R, and c++. I've heard that nodejs supports c++ so would this be the best way to go, and if so do you know of any good resources that would get me started in the right direction? Thanks in advance.
Submitted March 13, 2018 at 08:56PM by a9p6
Submitted March 13, 2018 at 08:56PM by a9p6
Oauth2.0 resources for learning
Hello guys. I am trying to get a grasp of authentication methods in Node.js applications, and got interested in Oauth2.0. However I can't find any proper guides for this service. Can anyone give me some tips or lead me somewhere where I can learn a bit more about it? I would like to add that I have already read the API reference on the Oauth site, and it's kind of hard to understand as I am still a junior. Thank you guys in advance.
Submitted March 13, 2018 at 09:26PM by wakali
Submitted March 13, 2018 at 09:26PM by wakali
Project/Folder Structure for Node/Express Apps
Hi there,There are lots of good tutorials out there for getting starting with Node and Express, but many of them end when you have a 300-line server.js file that handles a handful of endpoints with minimal middleware.That's obviously unmaintainable long-term, so what sorts of project/folder structure best-practices do you follow? Or, do you know of good documents out there?I'm not talking about monolith/microservices directly, here. This is just about project/folder structure for a developer to stay productive.I see some advocates of the typical MVC separation of concerns, but also have seem some compelling arguments to structure by components and against MVC.What has worked for you? What advice would you give someone starting up a relatively new app?
Submitted March 13, 2018 at 05:44PM by aust1nz
Submitted March 13, 2018 at 05:44PM by aust1nz
Using Promises to concatenate JSON objects in Node JS
http://ift.tt/2Htv0CQ
Submitted March 13, 2018 at 06:18PM by schumiman
Submitted March 13, 2018 at 06:18PM by schumiman
Stealing Bitcoin using NPM namesquatting
http://ift.tt/2tHYFpR
Submitted March 13, 2018 at 04:44PM by jonnyburger
Submitted March 13, 2018 at 04:44PM by jonnyburger
How to run a for loop synchronously in node JS and perform an operation, without loop moving forward?
Hi, So I'm stuck with a node JS problem. This is due the the async nature of node, I know that. But my problem is, I have an array, which I want to loop over, use the elements in the array to search for documents in mongoDB and then push the results in another array. My problem is that sometimes the array is returned empty when I log it after the for loop. For now, I've added a counter to check if the length of the final array is long enough, and then only move ahead. Here's my code:http://ift.tt/2GsQcJX sure that I haven't explained my problem properly, but I hope you get an idea. ThanksEDIT: I've heard about the async library, but really haven't understood the usage. If someone could explain in the above context, it'd be great!
Submitted March 13, 2018 at 04:49PM by mclovin4009
Submitted March 13, 2018 at 04:49PM by mclovin4009
Best node.js shops in Silicon Valley
What are the best Node.js shops in Silicon Valley
Submitted March 13, 2018 at 03:14PM by crispychick88
Submitted March 13, 2018 at 03:14PM by crispychick88
Great course for learning node.js. Integrating challenges to code on our own, applying the lecture, is a great learning tool. Andrew has a wonderful way of explaining things so that it's easier to understand. This has given me a solid foundation to start my first real app.
http://ift.tt/2EEdKxK
Submitted March 13, 2018 at 01:17PM by angela7walker
Submitted March 13, 2018 at 01:17PM by angela7walker
17 JavaScript / node.js performance coding tips to make applications faster
http://ift.tt/2Dm9Rbj
Submitted March 13, 2018 at 11:43AM by stanislavb
Submitted March 13, 2018 at 11:43AM by stanislavb
Monday, 12 March 2018
WebAssembly: What and What Next?
https://m.youtube.com/watch?v=R9wn99Xheq4
Submitted March 13, 2018 at 12:39AM by fagnerbrack
Submitted March 13, 2018 at 12:39AM by fagnerbrack
Where can I learn more about requests/request-promise?
I know it’s so basic, but where can I learn to fully understand it before giving it a go myself?I’ve looked through guides, but none really help that well. If there’s anyone out there that has done this recently - please feel free to link me to what helped you learn.Thanks all!!
Submitted March 12, 2018 at 09:58PM by v1zed
Submitted March 12, 2018 at 09:58PM by v1zed
Nodejs test structure noob question
Hello!I am new to the TDD world. I need to test API endpoints responses and I have some doubts on how to properly structure my tests. In particular, I need to test the HTTP Response code, the Content-Type header and check that the body contains some stuff.I have doubts about where I should do everything in one single it by chaining these tests, or it is better to provide different its for each of these.For instance, I could do this (done here):describe('GET /v1/accounts', () => { it('should return all the accounts', () => { return api.get('/v1/accounts') .expect(200) .expect('Content-Type', 'application/vnd.api+json') .expect(res => { expect(res.body.data).to.be.an('array'); expect(res.body.data[0]).to.be.an('object'); expect(res.body.data[0].type).to.be.equal('account'); expect(res.body.data[0].attributes).to.exist; }); }); }); Or I could do this (which is what I was going for before reading the option above):describe('GET /v1/accounts', () => { it('should return 200 OK', (done) => { api.get('/v1/accounts') .expect(200, done) }); it('should return Content-Type application/vnd.api+json', (done) => { api.get('/v1/accounts') .expect('Content-Type', 'application/vnd.api+json', done) }) // ... and so on }); Both approach work, so which one would you pick and why? Are there alternatives to these approaches?Thanks!
Submitted March 12, 2018 at 04:54PM by honestserpent
Submitted March 12, 2018 at 04:54PM by honestserpent
Please stop using console.log(), it’s broken… – Hacker Noon
http://ift.tt/2otnIYA
Submitted March 12, 2018 at 04:56PM by claustres
Submitted March 12, 2018 at 04:56PM by claustres
26 Resources That Will Help You Master Microservices Monitoring
http://ift.tt/2p7inXd
Submitted March 12, 2018 at 04:07PM by andreapapp
Submitted March 12, 2018 at 04:07PM by andreapapp
Unknown geoJSON type — MongoDB (99% sure geoJSON type is correct 🤣)
This is part of my schema in my mongo Database: location: { type: { type: String, default: "Point" }, coordinates: [{ type: Number }], address: { type: "String", required: "You must supply coordinates" } } userSchema.index({ location: "2dsphere" }); And this is part of the data I'm saving."location": { "address": "NY, USA", "coordinates": [ "-74.0059728", "40.7127753" ] }, And apparently this is an unknown GeoJSON type.What is more infuriating is when I make a "new User" it saves the location data correctly. And understands the geoJSON type. Only when I "findOneAndUpdate" does it not understand the geoJSON type.I looked and the data I'm saving is the same in both circumstances.Massive thanks for any help. I'm tearing my hair out here.
Submitted March 12, 2018 at 01:15PM by harrydry
Submitted March 12, 2018 at 01:15PM by harrydry
Using Apache Kafka for Asynchronous Communication in Microservices
http://ift.tt/2CLiifW
Submitted March 12, 2018 at 08:15AM by harlampi
Submitted March 12, 2018 at 08:15AM by harlampi
I couldn't find any good NodeJS libraries for Amqp + RabbitMQ so I started building one, if anyones got any feedback i'd like to hear it :)
http://ift.tt/2p8lAVt
Submitted March 12, 2018 at 10:20AM by TheWebUiGuy
Submitted March 12, 2018 at 10:20AM by TheWebUiGuy
The Best Practical Node JS Course! I was wondering how would Edwin build a CMS in Node.
http://ift.tt/2IlKJVy
Submitted March 12, 2018 at 07:30AM by alerrce
Submitted March 12, 2018 at 07:30AM by alerrce
Sunday, 11 March 2018
Making a call to API, using json data. Don't know where to begin.
Hi /r/node, I come to you in a time of need.I'm a complete novice at web development, but I've decided to focus on it for my project at university. I'm building an web application using Riot Games' API. I'm using express and express-handlebars to handle the data and display the data.My issue is that I have no idea on how to even approach using the API.I tried following a tutorial on async waterfall but I just got really confused, and even when copying in the data it was always returning "null" for some reason. If anyone cares, here is the code that didn't work. I'm not allowed to provide my API key, I'm sorry.I know how to handle objects, but I just have literally 0 idea on how to make API calls and return the JSON data. Can anyone point a novice in the right direction?
Submitted March 12, 2018 at 01:07AM by neeyol
Submitted March 12, 2018 at 01:07AM by neeyol
network strace on node function
I'm relatively network to node and i'm trying to write an app that monitors the network communications of a function.Has anyone ever been able to run and strace on just a function with node?
Submitted March 12, 2018 at 01:49AM by PaymentRequired402
Submitted March 12, 2018 at 01:49AM by PaymentRequired402
I Need help coming up with back end server application design
So I am programming a server in node.js for a project that a group and I are working on in class and we have to come up with an architectural design for our application. We are getting a little hung up on trying to design our back-end because the server we have has multiple services, like text chat, video streaming, and audio streaming and what not. Should we split up our back-end to have 3 different server programs running to handle each one of the services or how should we go about doing this?
Submitted March 11, 2018 at 11:25PM by appamaniac
Submitted March 11, 2018 at 11:25PM by appamaniac
Beyond Frontend JavaScript - what to learn specific to Node for getting a job?
I’m pretty well versed in JavaScript on the frontend, but I’ve never really touched Node beyond just messing around with Express and writing some very basic utility scripts.For a typical Node-specific fullstack engineering job, what are some must-have topics I’d need to know these days?
Submitted March 11, 2018 at 11:57PM by clownpirate
Submitted March 11, 2018 at 11:57PM by clownpirate
Using TypeScript With NodeJs
http://ift.tt/2p8IRXp
Submitted March 11, 2018 at 10:12PM by funJS
Submitted March 11, 2018 at 10:12PM by funJS
Driver.js – A lightweight engine to drive user's focus across the page
http://ift.tt/2FAt62N
Submitted March 11, 2018 at 09:27PM by kamranahmed_se
Submitted March 11, 2018 at 09:27PM by kamranahmed_se
Node Learning Track
Hi /r/node!I have an idea for a DB driven website that I don't want to write in Ruby/Rails. Figured it might be a good opportunity learn Node.Trouble is, I don't really have a background in JS, so not really sure where to begin. Should I start with JS? If not, what's a good Node resource that doesn't assume JS knowledge on the part of the reader? I faced a similar dilemma when learning Rails.Thank you!
Submitted March 11, 2018 at 08:43PM by ribbonsofeuphoria
Submitted March 11, 2018 at 08:43PM by ribbonsofeuphoria
best approaches to setting up environment
I've been running into a lot of issues using NVM to update my version of Node.js and keeping track of where my global modules are installed, and keeping them updated and in sync with one another.How do you set up your Node environment? How do you keep global modules (Express, Webpack, Angular-Cli, Vue-Cli) up-to-date?At this point I feel like I might be better off deleting all of it and starting over.
Submitted March 11, 2018 at 06:41PM by crashspringfield
Submitted March 11, 2018 at 06:41PM by crashspringfield
Up to date beginner node guide? (Udemy?
Hey,I just searched some node courses on Reddit and found many Udemy courses. But often some people comment that these courses are outdated - they aren’t using the latest syntax. And because I want to start learning node I would like to learn the latest things. I know the basics of JavaScript but never really worked with node. Which course would you recommend me? Maybe it should also help with the basic things like working with an api, working with requests / responds etc.
Submitted March 11, 2018 at 04:34PM by Mxfrj
Submitted March 11, 2018 at 04:34PM by Mxfrj
Nodorithm - an NPM package for calling commonly used searching and sorting algorithms. Contributors welcome!
http://ift.tt/2HnBTFt
Submitted March 11, 2018 at 12:54PM by sharadbhat7
Submitted March 11, 2018 at 12:54PM by sharadbhat7
Is There Any Production level app on GitHub?
The thing is that I am currently learning React plus Express(MERN stack app) and would like to say how it is in production. So would like to know if there are any projects on github. Also it would be great if these projects would have tooling of some kind like using babel,webpack,grunt,gulp and CI tools ike circleci.
Submitted March 11, 2018 at 07:37AM by datavinci
Submitted March 11, 2018 at 07:37AM by datavinci
Saturday, 10 March 2018
Scheduler for Node JS and MongoDB
Hey guys so I have been researching about any good way to schedule an event that need to be fired at a particular date and time. So I have Contest Object in my MongoDB that has a start date and an endDate. Now is there any way I can schedule an event to get fired by my node js server when that date occurs. For example, I created a contest that has a start date of 18th March 9 AM. I want my node js server to fire up a particular event when that time occurs. Let me know if you guys need some more clarification as I am pretty confused as to how I do I store these event to fire up on that particular date and time. Any help is appreciated. Thanks!
Submitted March 11, 2018 at 02:47AM by schumiman
Submitted March 11, 2018 at 02:47AM by schumiman
Is it worth learning C++ for use with Node?
I'm learning Node and loving it so far. I'm a curious person and I would love to learn c++ as well (the idea excites me, like a proper nerd!), but I'm having trouble justifying it to myself career-wise (as a combination with JS).I know that you can write c++ add-ons for node, but in practice, is this really so common that career-wise it would be worthwhile to learn (instead of focusing on more common web development languages)?Thanks!
Submitted March 10, 2018 at 11:10PM by rollickingrube
Submitted March 10, 2018 at 11:10PM by rollickingrube
Converting Mustache templates to use Angular server side rendering
http://ift.tt/2Fs3SHN
Submitted March 10, 2018 at 10:40PM by funJS
Submitted March 10, 2018 at 10:40PM by funJS
Bull vs Bee Queue - Job management; which one when and why?
I'm have to setup a small worker that will process short tasks in que. Most of my jobs will consist of simple JSON API calls. I would need a queue/cache system as the API is unreliable and can go down for a few minutes to hours at a time.I been doing some research on the available packages out there and I'm stuck between these two. Bull seems to be more advanced and comes with more tools, but has a slower performance than Bee Queue. Both come with an UI which is a plus. I was wondering if anyone has any experiences with these two.
Submitted March 10, 2018 at 10:20PM by fexra-shell
Submitted March 10, 2018 at 10:20PM by fexra-shell
How do you guys feel about Visual Studio for Node development?
I used to write C++ / C# in Visual Studio back in the mid-2000s, and decided to open up a Node project in Visual Studio Community just for kicks and giggles.Just from a moment's glance at the interface, it seems like it might be a solid experience. I know it's not as popular as VS Code (which I'm also a fan of), but it definitely seems to be an option.Anyone here try it out and can compare to other IDEs (i.e., WebStorm, etc.)?
Submitted March 10, 2018 at 08:12PM by SalemBeats
Submitted March 10, 2018 at 08:12PM by SalemBeats
I just uploaded out Auth app in to Heroku. Please let me know if you have any questions or comments. You guys have been awesome!
https://youtu.be/R3OV9Q0HdqY
Submitted March 10, 2018 at 06:32PM by sheffmaster
Submitted March 10, 2018 at 06:32PM by sheffmaster
This Node course teaches the novice everything from the ground up. Literally. Jack Davis is very thorough in explaining what he is doing every step of the way, and as a user, I feel empowered when I see the same results on my own machine when I work along with him.
http://ift.tt/2oYNy6V
Submitted March 10, 2018 at 02:14PM by alerrce
Submitted March 10, 2018 at 02:14PM by alerrce
I need help with this linux command
Hello, i am making an server monitoring software: http://ift.tt/2FxUZID i am now trying to run echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')] command on child_process but i just keep getting error of it.
Submitted March 10, 2018 at 01:45PM by kek98
Submitted March 10, 2018 at 01:45PM by kek98
How can I convert a DateTime in a mysql database (2018-03-25 23:59:59) to a 'days remaining' variable in node.js?
Hi, I'm making a discord bot and need to somehow convert that date into a simple days remaining integer and store it into a variable in node.js. How would I convert it to an integer?As of now I have a query which converts it to unix timestamp stores the result in a variable. When I console.log the result it comes up as:[ RowDataPacket { 'UNIX_TIMESTAMP(myTable.expires_at)': 1523429999 } ]
Submitted March 10, 2018 at 08:43AM by Brinstakilla
Submitted March 10, 2018 at 08:43AM by Brinstakilla
Friday, 9 March 2018
twit/npm chunkedMediaUpload
I am currently having a problem with a bot i am making. I am not sure how to upload videos greater than 30 seconds to Twitter using Twit. I keep getting the error, "Not valid video".
Submitted March 10, 2018 at 02:00AM by chidiu98
Submitted March 10, 2018 at 02:00AM by chidiu98
Perform user defined tasks server-side
As the title suggests, I am looking for the best way to implement a feature where the user defines specific conditions where they would like to place a bid on an item. The catch is I want this 'buy' to occur regardless of the user being logged in to the client ui. Also, the prices are coming from a third party api. If the user was always logged in I could use their computer to watch the prices and perform the buy when the condition is met, but emulating this server side seems like a massive use of resources and I am not entirely sure the best way to implement it
Submitted March 09, 2018 at 08:29PM by MrStLouis
Submitted March 09, 2018 at 08:29PM by MrStLouis
Building a Wine Tasting Neural Network with Node.js
http://ift.tt/2p0JYsa
Submitted March 09, 2018 at 06:51PM by code_barbarian
Submitted March 09, 2018 at 06:51PM by code_barbarian
Properly measuring HTTP request time with node.js
http://ift.tt/2F0hc5M
Submitted March 09, 2018 at 07:13PM by dobkin-1970
Submitted March 09, 2018 at 07:13PM by dobkin-1970
Npm package that scores images on visual interest?
Trying to find a .js function that can process images and spit out a number for comparatively scoring how interesting the image might be. Would use to programmatically pick the top/first photo/screenshot for a given entity.
Submitted March 09, 2018 at 04:31PM by dsbud
Submitted March 09, 2018 at 04:31PM by dsbud
after installing react and react dom i get npm error
i checked before i had this dir note\node_modules\npm\bin\ after installing somthing it getting removed and i get error trying anything with npm. somebody know how to fix it? check log down hereC:\Users\Klief\Desktop\note>npm install --save react react-dom npm WARN ajv-keywords@3.1.0 requires a peer of ajv@6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN note@1.0.0 No description npm WARN note@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x6 "})react-dom@16.2.0react@16.2.0 removed 476 packages and updated 2 packages in 23.598sC:\Users\Klief\Desktop\note>npm install --save react react-dom module.js:549 throw err; ^Error: Cannot find module 'C:\Users\Klief\Desktop\note\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 module.js:549 throw err; ^Error: Cannot find module 'C:\Users\Klief\Desktop\note\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3
Submitted March 09, 2018 at 03:57PM by kliefados
Submitted March 09, 2018 at 03:57PM by kliefados
Is NodeJS/Express/Angular the right fit for a community website? Frustrated.
This post may be a bit long/ranty, but I'm feeling (perhaps more than) a little frustrated with my research into NodeJS/frameworks. Maybe this isn't the right place to ask, but I need some input from those more familiar with NodeJS and all the related frameworks to help steer me in the right direction.I did web development for around 10 years (PHP/MySQL/HTML/CSS/JS), until a couple of years ago when I abandoned it to pursue my real passion (game development).Recently tasked with developing a new website for an online community I am part of, I thing it would be a good opportunity to learn newer technologies for web development (especially as PHP drives me nuts now). I've been going back and forth between Ruby on Rails and NodeJS, but I think NodeJS may be a better bet as I'm way more familiar with JS than Ruby.I'll explain the project first. For general visitors (and search engines) it will be a collection of static pages like any typical website. Where it gets involved, is for members - OAuth login, webhook integration with a third party service, multiple member tiers, data exports to various formats, etc. Basically, automation and tools for managing and interacting with the community.My initial thought process after doing some research was to design it as an ExpressJS API backend, with an AngularJS frontend. This made a lot of sense to me, initially. I've managed to find well-documented libraries for handling various aspects, such as Passport for OAuth and a JWT library for detecting user authentication between frontend/backend. However, as I delve deeper, I'm getting frustrated with what seem like the basics.For example, while the Express documentation is really good at explaining the API, I've yet to find a good explanation on how to structure an Express project. Most tutorials just put everything in app.js (we're really still doing this in 2018?) and few have spread things across "component" files but offer no explanation beyond "put this code in x.js". Is there no standard structure? Is MVC just loosely implied in NodeJS frameworks rather than strictly forced like in Rails?Another example is with the Angular frontend/Express backend approach, that SEO will be an issue for all of the static pages. I came across Angular Universal, which should be the solution but also puts so many architectural questions in my head. It's not really needed for the places where Angular would be used (logged in users), yet if I stick to the API based approach it seems like a really big weird caveat-filled workaround for static pages that Express could just render itself. Likewise, if I wanted to have these pages dynamically load by AJAX as well as still function statically, this wouldn't be suitable either. Is there not a better approach?The more I dig the more unsure I get. Almost every tutorial and guide I find is about using NodeJS/Express/Angular to make an SPA (are todo lists the new hello world?), whereas I think what I really want is an "MPA".Overall I think I'm misunderstanding something or falling into the classic "using a hammer to put in a screw" trap. Am I looking at the right toolset here? Are there frameworks other than Angular/Express that would be a better fit? Or are they the right tools but I'm just using them wrong? Should I look at a different architecture entirely?TL;DR - Is a NodeJS/Express/Angular stack the best fit for a community website with a mix of static and dynamic content?
Submitted March 09, 2018 at 12:48PM by Fourjays27
Submitted March 09, 2018 at 12:48PM by Fourjays27
Subscribe to:
Posts (Atom)