Skip to main content

Questions tagged [node.js]

Node.js is an event based, asynchronous I/O framework that uses Google's V8 JavaScript engine. Node.js is commonly used for heavy client-server JavaScript applications.

Filter by
Sorted by
Tagged with
3 votes
1 answer
72 views

For a library I am working on, I have created a class WatchableCollection which will monitor an endpoint of an API for updates and issue events (...
bren's user avatar
  • 133
7 votes
1 answer
400 views

I have this code that fetches data from a 3rd party api and sends it to my backend to be processed. The 3rd party api needs to target the user's localhost address so it has to come from the front end. ...
Adrian Sultu's user avatar
4 votes
2 answers
415 views

I am trying to restructure a function more clearly and readable that has multiple return statements. Usecase Get a token: if the token does not exist in the database then generate a new one and ...
Kay's user avatar
  • 143
3 votes
1 answer
1k views

I have a use case where I need to run multiple tasks in series. Each task is required to perform some database operations. In my code step_1, ...
Dakait's user avatar
  • 133
1 vote
1 answer
587 views

I am trying to create a navbar menu from JSON data. Actually I have achieved it but I am looking for feedback not to call getItems twice? How can I improve my code? ...
nanokozmos's user avatar
1 vote
0 answers
841 views

I'm trying to implement a SQL transaction management in Node.js, that would append queries to an existing transaction if available, or create a new one if none exists yet, thanks to an optional ...
sp00m's user avatar
  • 111
7 votes
1 answer
4k views

From HackerRank's 10 Days of JavaScript, Day2: Loops: Complete the vowelsAndConsonants function in the editor below. It has one parameter, a string,s, consisting of lowercase English alphabetic ...
Mohit's user avatar
  • 73
-2 votes
1 answer
77 views

I'm working on a Node.js chat app project using the ws library. I have it up and running but I'm still making improvements and adding stuff like authentication, etc....
Elijah Mock's user avatar
2 votes
2 answers
96 views

The Requirements: List the expensable items sorted by date and location given two variables: 'categories' and 'expenses'. The Categories variable provides the following information in order: Category ...
amalgamate's user avatar
4 votes
1 answer
5k views

After some time poorly designing my web applications' backends (mixing database calls with the controller, etc.), I have decided to try the "Clean Architecture" approach. In this example I have a ...
kibe's user avatar
  • 277
0 votes
1 answer
94 views

Review Wanted Application Summary The application is a simple screen scraper which is to notify the user when new items are posted. The code is run as a CRON job every ten minutes. It will scrape the ...
John S.'s user avatar
  • 171
4 votes
3 answers
246 views

I have this script which works perfectly but I experienced some delays because of these 2 for loops [i][j]. Is there any way to ...
Nodegeek's user avatar
  • 151
2 votes
0 answers
53 views

I want to have a test fail, because the email already exists, so I create [email protected] and [email protected], but is there a way to do it without this? ...
Ibn Rushd's user avatar
  • 245
4 votes
2 answers
222 views

Here's a function I use to generate a 2.5 gig SQL dump file for testing. It works but it takes a long time. How can I make it more efficient? ...
I wrestled a bear once.'s user avatar
2 votes
0 answers
134 views

I'm in the process of creating my first web app using node with mongodb on the backend. I could use some opinions on the schemas/models I've set up. I have three schemas: User, Pet, Food. Here's the ...
pfinferno's user avatar
  • 447
2 votes
1 answer
1k views

Application Summary I received a call from a client asking for a "simple app" that notified him via text message whenever a "Jeep Wrangler" is posted to Facebook Marketplace. It ...
John S.'s user avatar
  • 171
1 vote
1 answer
97 views

I'd love some pointers on how to refactor this ...
nz_21's user avatar
  • 1,051
4 votes
1 answer
765 views

Description I've developed an application which use axios to communicate with the PayPal API. PayPal has a NodeJS SDK, but unfortunately this doesn't support the ...
sfarzoso's user avatar
  • 117
2 votes
0 answers
39 views

I have a Lambda function that processes incoming messages and sends emails based on an enum type property in the message. I have N number of "handlers", one per <...
Charlie Schliesser's user avatar
2 votes
1 answer
135 views

I am new to this part of backend development using JS and the truth being a new programming language (for me) it is worrying that it suddenly does not meet the structuring and / or security standards. ...
jecorrales's user avatar
3 votes
0 answers
434 views

I'm looking for a review of my backend code on how to keep it more DRY. I see a lot of repetition in validation part of email and password, also I need some advice on if I have used the try-catch and ...
ubuntu7788's user avatar
3 votes
0 answers
49 views

I want to decode a request object before use it in an insert query. Request object containes the following JSON body: ...
Karol-Kahn's user avatar
3 votes
1 answer
156 views

I wrote an express API for a document management service (repo to be found here) and even though I understand the importance of unit-testing I never quite managed to wrap my head around how I would ...
Felix Wieland's user avatar
0 votes
1 answer
294 views

I took some time to try and solve a problem. I am building a basic Node + Express API. In the app I have created a models folder and will be adding new models as I continue development. I attempted ...
Dewald Els's user avatar
3 votes
1 answer
1k views

I need to read multiple CSV files that have the same number of rows, and compute some results for each row. For simplification purposes, and in the scope of this code review, this computation would be ...
7hibault's user avatar
  • 139
-1 votes
1 answer
507 views

I've wrote a piece of code today that really make me sick about: ...
Tiziano's user avatar
  • 111
0 votes
1 answer
82 views

I have these following controller functions for registering a user and login, in my app, and I want to make it more clean and maintainable. Probably by using ...
ubuntu7788's user avatar
1 vote
1 answer
168 views

I am building an ad-hoc text-editor. I have two functions which use a cache, provideHover and provideCompletionItems. ...
nz_21's user avatar
  • 1,051
-2 votes
1 answer
124 views

I'm looking for any advice on the way I have implemented methods (explained below). More specifically, is it a good practice or not? And if not, any suggestions? NOTE - ...
infinitecode's user avatar
3 votes
3 answers
495 views

I'm trying to create pages for multiple content types in Gatsby and I was wondering if this is the right approach: My gatsby-node.js file: ...
Tim Peterson's user avatar
4 votes
0 answers
179 views

The objective of the game is to guess the hue, saturation, and lightness values of a given color swatch across ten rounds. https://github.com/shreyasminocha/guess-the-hsl https://guess-the-hsl.now.sh ...
shreyasminocha's user avatar
1 vote
2 answers
1k views

In an interview I was asked to solve two JavaScript questions. I thought I did pretty well because I: Covered the edge cases Wrote comprehensive tests Documented the code using jsdoc The interviewer ...
suchcodemuchwow's user avatar
3 votes
1 answer
229 views

Background I crated a CLI tool which executes an npm command (to create a react app) and modifies the contents of the generated files. It was a practice attempt at ...
nopassport1's user avatar
0 votes
1 answer
84 views

I always want to improve my code by refactoring but when I've to work with complicated function that have many thing to do . How can I refactoring them. Here is my data for example I get data from ...
Ach's user avatar
  • 11
2 votes
2 answers
73 views

I am trying to check that a list of files are all images using functional programming. Some actions I go through are asynchronous, so I have to wait for them to completely finish before passing to a ...
Yann Bertrand's user avatar
4 votes
0 answers
366 views

I have been working through Introduction to Algorithms 3rd Edition, and have implemented an AVL tree through prototypal inheritance. The code presented here does work as expected based on the tests ...
Evan Bechtol's user avatar
  • 1,265
0 votes
0 answers
742 views

I've wanted to try Rust and WebAssembly for a while. I recently realized that I could try both at the same time by compiling Rust to WebAssembly. I wanted to know what the performances of something ...
7hibault's user avatar
  • 139
3 votes
1 answer
1k views

I'm not an expert in authentication, so I want to make sure I have done everything right. I am using crypto.createCipheriv and ...
ZiiMakc's user avatar
  • 133
2 votes
0 answers
35 views

I would like to build a common helper for my application that will manage all the amqplib calls from all of my nodeJS microservices. I would like to import my amqplibHelper to every microservice and ...
Omtechguy's user avatar
  • 161
5 votes
1 answer
119 views

This program constantly sends an https request to Reddit's API for new comments. Using a PostgreSQL Database containing Regular Expressions, find comments of interest and notify about them using faye....
dustytrash's user avatar
  • 2,446
2 votes
1 answer
93 views

I am going to have multiple APIs in routes folder should I put them in in the same file API or separate them? ...
mohamed adel's user avatar
1 vote
1 answer
110 views

Hello I have a NodeJS which act like an interface it connects the client(mobile app) to the actual server My node JS API receives data from the client to verify it and send it to the server. I want ...
mohamed adel's user avatar
2 votes
0 answers
132 views

I'm working on an AWS lambda function that take data from two mongodb databases, find the matching records between two collections by 'id' and calculate each record commission by fixed rate. Then ...
khanhdn's user avatar
  • 21
2 votes
1 answer
80 views

I am currently learning how to create nodejs express rest api using async making it fully scaleable and secure. My goal is to ensure maximum functionality and speed, currently I am using MVC ...
Jojo Bagings's user avatar
5 votes
1 answer
93 views

The Reason The reason I designed this code was that in many cases, when I wanted to test code in the browser that would be running on a Node instance, the code that I was copying (Don't worry, copying ...
FreezePhoenix's user avatar
3 votes
2 answers
205 views

I have this code to get the current timestamp so that I can save it as a part of the key in leveldb database. ...
Sanjay Idpuganti's user avatar
2 votes
0 answers
49 views

The backend part has the following purposes. An endpoint that takes a search term and returns a list of repositories. An endpoint that allows bookmarking a repository by its id. An endpoint to get all ...
Naveen Chand's user avatar
2 votes
0 answers
49 views

I've decided on splitting my environments keeping them in .js files in an environment folder and keep all the sensitive information in .env file (use a third-party module 'DOTENV'). That's what I've ...
Valary o's user avatar
  • 171
5 votes
1 answer
102 views

This is more to get clarity on an implementation that I did. I am working on a React, Node, and Electron application that essentially has a form that a user inputs values that will update some content ...
Grant Herman's user avatar
4 votes
1 answer
1k views

I'm learning javascript with discord.js and node and I'm always looking for the "best" code. Is this the "best code" for my map() ? ([role] required, (role) optional) ...
Padd's user avatar
  • 151

1 2 3
4
5
19