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
1 vote
1 answer
18 views

Javascript CLI to boot iOS simulators, install project, extract data, and merge into JSON

I'm a DIY "dev" - so I really create things that I need or think they'll end up helping others. I wrote this Swift Package so the iOS community could get device bezel radius' to help with UI ...
markb's user avatar
  • 171
1 vote
0 answers
40 views

Functional style dependency injection to make business logic unit-testable

My project is a blogging app, which is a recruitment assignment. It is now finished and working. Following function handles updating a comment votes, very similar as on StackExchange sites, preventing ...
jirkamat's user avatar
  • 111
2 votes
2 answers
105 views

Permissions system in MERN app

I am working on a MERN stack app that is a CRM with a couple of modules. Now when the user sends x request to the server to do a supposed action (such as delete something), the server first checks if ...
Syed M. Sannan's user avatar
0 votes
1 answer
35 views

js template engine

I am building a template engine for js and I need some help refactoring the code for fast and more efficient performance. If you can help modify or suggest some updates I'll be grateful. ...
ahmed qoreichi's user avatar
2 votes
1 answer
47 views

Session-based authentication using Express.js

I'm currently learning Express.js and I wrote this authentication code. I'm unsure if what i have is correct, how to improve it and if it's secure. For user and session data storage I'm using ...
Krneki123's user avatar
0 votes
0 answers
52 views

small app with bad practices on node.js and vue.js

Can someone help me to understand and give me code review of my small todos APP, why my code in backend is bad? Also give me a answers for some of my questions, please: Where my code is bad? Where do ...
Олег Лазорик's user avatar
0 votes
0 answers
30 views

Detecting the content type of a given http body/string

I am trying to detect the content/mime type of a given Buffer/string. In other words, I am trying to guess what on earth is a given string. My approach is somewhat brute-force: ...
Dimitrios Desyllas's user avatar
1 vote
0 answers
30 views

Asynchronous Generic Resource Pooler

A personal project I'm working on needs Worker (thread) pool. The libraries I looked at were too high-level for my needs, as I simply needed access to the Worker itself while the libraries offered ...
Slava Knyazev's user avatar
0 votes
0 answers
28 views

Accumulate chunks of data and consume fixed size buffers

From a stream, I receive buffers of varying length. I want to consume chunks of fixed length from this stream. I build a buffer accumulator to accumulate the chunks in an internal array, then I can ...
Louis Coulet's user avatar
0 votes
0 answers
36 views

Write Node.js code to receive HTTP calls that initialize and update objects stored in JSON files

This is a backend side of Node.js running a simple Http endpoints for a monitring system for a time-related task I recently developed a habit that I would rather spend time to make the code as less as ...
Chase's user avatar
  • 191
1 vote
0 answers
46 views

Weather and health app

This is a weather app that provide health and weather details based on the location you enter. Can someone help me to review my code? ...
Salvius Fernandes's user avatar
3 votes
0 answers
34 views

Automatically extract useful cars from car site

I am using puppeteer to extract data and see when a car that meets my requirements shows up, this is what I did so far. I would like some basic syntax advice, or more advanced tips as well. I tried to ...
Mah Neh's user avatar
  • 31
0 votes
0 answers
49 views

Cafegent backend: table management API using Express JS

I a new to coding and certainly new to this site. I apologise advance if I offend anyone or any rules. What should I do to further improve the code. Any suggestions would be appreciated. This code for ...
Debarka Mondal's user avatar
0 votes
0 answers
32 views

EVM Proxy Smart Contract Detector

This code flags potential Ethereum Virtual Machine (EVM) proxy contracts. Almost all proxy contracts are not auditable, since the code can be changed at any moment, and so should be avoided by users. ...
Jonathan's user avatar
  • 141
1 vote
2 answers
45 views

Extend native `Array` instances

I need/want to extend created array instance, to add extra methods that i see as useful. class.labels.js ...
Marc's user avatar
  • 133
-1 votes
1 answer
103 views

Using JavaScript to interface with REST APIs

The website TryHackMe came up with a challenge that involves using HTTP requests to interface with REST APIs (here, task #14/day 9). The challenge basically involves querying a basic REST API to ...
Aleksey's user avatar
  • 143
1 vote
0 answers
45 views

Fetch external API currency rates, then save the results to database

The task I'm doing is, fetch external API, then save the results to database. I'm a beginner, I really wanna improve my code, to handle error well, and remove redundant code. The code is working, but ...
hsl's user avatar
  • 11
0 votes
0 answers
116 views

Queue system for a 1v1 multiplayer game in node.js with socket.io

I'm trying to create a simple node app utilizing socket.io rooms where users can play a 1v1 game against other users. The system I have in place at the moment is when a user clicks the play button ...
HDawG's user avatar
  • 33
3 votes
1 answer
63 views

Basic node authentication system

I built a basic authentication system for a node application and I have some security concerns. The username and password the user enters when they log in are stored as plaintext using express-...
HDawG's user avatar
  • 33
2 votes
1 answer
125 views

Command handlers in node.js

Description This javascript code uses tmi.js to listen for chat messages in a Twitch chat and perform certain actions depending on their content. In the sample code ...
Patrick Christie's user avatar
-2 votes
1 answer
66 views

Reducing complexity and making it more readable [closed]

I have this NodeJS code which I need to Reduce complexity and making it more readable coz it has to many repeatable loops, and the api is very slow how do i fix this. ...
Prajwal K Rao's user avatar
0 votes
0 answers
119 views

Link tracking with NodeJS

I want to create a service to track affiliate link clicks. The logic is simple, When a user is clicked on the link provided by the service will redirect to an original affiliate link. I stored data in ...
Siyum's user avatar
  • 1
3 votes
1 answer
114 views

How can I condense my code in node.js for sorting unique values within an array?

Kattis problem - ("I've been everywhere") I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
doroshm's user avatar
  • 33
3 votes
1 answer
44 views

Generate total property sold for given postcode

I had to implement the below as a coding challenge. There are two http endpoints. The first http endpoints returns a list of postcodes. The second http endpoint takes a postcode as a parameter and ...
hulike2286's user avatar
2 votes
2 answers
87 views

Find differences between two arrays

I have to identify added and deleted items between two objects with the same structure. ...
Elias Bobadilla's user avatar
0 votes
1 answer
43 views

Nodejs Module Pattern And Caching

The question is about nodejs module pattern code structure. My goal is to initialise the module at one time and export the module using module.export so that, it's ...
Sreejith sreeji's user avatar
1 vote
1 answer
37 views

Function that querys database and then renders a view

Im new at backend development and I'm noticing that my code is very messy and difficult to read. I know this doesn't have a single correct answer but id like to know how I can make my code tidier when ...
guido's user avatar
  • 13
1 vote
0 answers
112 views

Skyrim API, no previous experience

I recently created my first API, I intend it to be open source so anyone can contribute, what are the best practises I missed? What should I include in the API? For now it only does contain single ...
FColor04's user avatar
1 vote
1 answer
72 views

Optimising a simple graphql mutation resolver

I am writing a resolver for a typical updateUser mutation with node, Apollo Server and mongoDB. I want to make it such that, when the ...
user8758206's user avatar
3 votes
1 answer
90 views

A Language Bot: For creating noun declension or verb conjugation tables

I'm a freshman student. What does my program solve? This is actually a bot for reddit, and there are language learning subreddits on that website, sometimes when discussing something with people, we ...
user9560064's user avatar
4 votes
1 answer
945 views

NextJS with a root level catchall route for all URLs dynamic middleware that splits into components

Here is the solution that I have. Due to the legacy product we have all of our URLs in one big Slug model in rails that maps URLs to models. EG ...
Romuloux's user avatar
1 vote
0 answers
1k views

Node.js batch processing

Batch processing steps: When a job is posted, push it to the queue. Get the required number of items from the queue and put it in the ...
sg7610's user avatar
  • 370
2 votes
1 answer
49 views

the mini js tool library

I am a newbie js "developer" and for practice, I created a tiny (8 methods) JavaScript library. I need you to give me feedback "should I keep expanding my library or switch to something ...
delaklo's user avatar
  • 23
1 vote
0 answers
59 views

Nodejs - Javascript buffer that takes in uint64, enum and string data as input

I am writing a nodejs program that adds some data into a buffer, before it is streamed. The data types are listed in the comments of the code, and there are fixed places in the buffer that these data-...
Barney Chambers's user avatar
0 votes
1 answer
68 views

Simple websocket chat app, security and efficiency concerns

I'm coding a simple websocket chat app. I was wondering if my code is secure and efficient. I also have a question about the way how I'm sending objects and then checking the type, is there anything ...
Jiry_XD's user avatar
  • 21
0 votes
1 answer
340 views

Using a RegEx to create a UUID string

I'm writing a Discord bot that sometimes requires a Minecraft account UUID to be looked up so this is the function (and MWE) I have written to do this. ...
Jake's user avatar
  • 131
2 votes
1 answer
94 views

Basic node login routes for authentication system

I am building a basic authentication system with a node backend and wonder whether I am using the try-catch block excessively. I have this example controller: ...
user8758206's user avatar
1 vote
1 answer
141 views

Updating large and heavily nested JSON properties based on existing properties using nested forEach loops

The structure of the JSON is as such: Each parent record can have many DataGroups and each DataGroup can have many ...
Faahmed's user avatar
  • 113
1 vote
0 answers
29 views

Creating records in several tables with a single mutation

I'm studying nodejs w/ graphql and I would like to make sure I'm going in the right direction here. My study project is based on a simple ERP with entries, products, orders and users. I have one ...
Ianagos's user avatar
  • 11
3 votes
1 answer
190 views

Server code to upload and save images to cloud storage

Is there a way to beautify my code? It works but there repeated blocks and I am not sure that I'm using some functions in the right way. I'm not new to JavaScript but I want to improve it and get rid ...
Denis Cherepanov's user avatar
2 votes
0 answers
578 views

Cows and bulls game in JavaScript

I've been working on this game the last 2 days. The game is working but I need a feedback for my code. Can it be made simpler? Sorry if my code is very complicated or not well written: I am in the ...
Cristoforos choras's user avatar
1 vote
1 answer
2k views

Process a binary file by chunk using a read stream in nodejs

I want to process a file chunk by chunk to prevent memory exhaustion. I need to consume the file using a read stream. When trying it, this implementation seems to work fine. I am asking your expert ...
Louis Coulet's user avatar
0 votes
1 answer
77 views

Spawning a child process that is accessible in global scope through use of eval()

So basically my question is what would be a better way to achieve my goal? The code below works fine but looks like it is extremely inefficient and could be achieved in a better way. The code ...
WoJo's user avatar
  • 103
0 votes
0 answers
13 views

ETL script that makes request and the log it into a table

...
Sayaman's user avatar
  • 299
1 vote
1 answer
103 views

Three efficient JavaScript functions that converge to pi extremely fast

I am learning JavaScript and decided to translate my Python scripts into JavaScript. Approximations of π are extremely popular programming challenges and I am sure they must be a staple of the ...
Ξένη Γήινος's user avatar
1 vote
1 answer
175 views

JavaScript function that generates Fibonacci like sequences of given order

Generalizations of Fibonacci numbers Fibonacci numbers of higher order A Fibonacci sequence of order \$n\$ is an integer sequence in which each sequence element is the sum of the previous \$n\$ ...
Ξένη Γήινος's user avatar
3 votes
1 answer
146 views

A simple JavaScript function that does prime factorization

This is a simple JavaScript function that does prime factorization. I wrote it on an Android phone with online editor (I don't have access to computers in night time): Code: ...
Ξένη Γήινος's user avatar
2 votes
2 answers
812 views

FizzBuzz in JavaScript (node.js), my first JavaScript program

I had just decided to learn JavaScript, so I wrote this program. I am sure you know what FizzBuzz is so I wouldn't describe it here. Console output: ...
Ξένη Γήινος's user avatar
0 votes
0 answers
39 views

Compare aggregate values of data grouped by date

I've got a working code that transforms data from a MySQL database. Currently, it's inefficient because it uses about loops, which you'll see at the bottom. I get an array of objects from a database ...
Tony's user avatar
  • 101
2 votes
0 answers
141 views

Simple websocket chat app

I'm coding a simple websocket chat app. I was wondering if my code is secure and efficient. I also have a question about the way how I'm sending objects and then checking the type, is there anything ...
Jiry_XD's user avatar
  • 21

1
2 3 4 5
20