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
0
votes
0answers
7 views

Simple Markdown Blog

this is my first real website I created after learning about web development. It's amazing to me that anyone would spare their free time to code review strangers' code. So thank you in advance. I'd ...
2
votes
1answer
27 views

Arithmetic quiz on the command line

I am writing a program that asks questions, takes the user's input, and responds according to whether the answer they gave is correct or not. I am looking to improve my code with respect to ...
2
votes
1answer
75 views

Learning asynchronous caching by implementing one

After implementing a serial CLOCK second-chance cache in C++ without having enough rope to shoot myself in the foot, decided to dive into Javascript through NodeJs and write an asynchronous one. I ...
0
votes
0answers
9 views

Socket.io: Pairing from two rooms without repeated pairing?

I'm working on a user-pairing algorithm using socket.io, and it is running on Node.js. I want to make sure that no repeated pairings will happen when people connect in. The steps of the algorithm as ...
1
vote
0answers
13 views

Getting metadata out of a Shoutcast stream

I have written the following class used to get the metadata out of an internet radio station. It takes a Node Stream and transforms it to grab the metadata out of the mp3 stream and then removes the ...
2
votes
0answers
29 views

Node.js Dumbserver

Dumbserver, or the simplest workable HTTP server. It is supposed to operate in the 'traditional' way, that is, mapping paths in requests to the directory structure. Why did I write it: I needed a ...
1
vote
0answers
18 views

basic node.js controller action with get request

...
3
votes
0answers
23 views

Fetching data from endpoint, retrieving coordinates, then merging into an output

I'm in no way a skilled developer (or even a developer at that!) but I did want to take a go at writing a script that fetched one endpoint's data, extracted some data, sent if off to be geocoded, then ...
0
votes
0answers
23 views

Validation handler in node.js

...
0
votes
0answers
22 views

Memory Allocation problem in codewars: Improvements to use less memory : Tribonacci sequence

Consider my following code from the Tribonacci sequence kata. ...
1
vote
2answers
54 views

A function to find all the primes between two numbers whose reverse is also a prime and doesn't include palindrome, in JS

I am trying to solve a challenge in which I have to write a function that takes in two numbers as arguments and returns an array containing numbers between them which are prime and their reverse is ...
1
vote
0answers
19 views

How to implement robust and secure session management (in general, and in Next.js)

I am using Next.js and want to properly implement session management into this serverless architecture. I checked out nextauth but I am not really a fan and it doesn't implement some things I think I ...
0
votes
0answers
11 views

Does using the multiple setTimeout decrease the performance of the nodejs app

Cancel the old timeout for the trip. Find the trip by Id validate it. Find the new driver not in old driver. If driver not found Try again Sent request to the new driver. Update the trip driver. Sent ...
1
vote
1answer
110 views

Common CRUD function in node js using Express

I have created common function for CRUD operations. I am using Sequelize JS, I have created all models in Sequelize I have written stored procedures in mysql for CRUD operations for each module/...
0
votes
0answers
11 views

manipulate "require" to load files from a "virtual file system"/in-memory

Im trying to implement a plugin system. A plugin is a compressed gzip tarball with files and folders. The tar file gets extractet and stored in memory. (The files are never written to the filesystem) ...
1
vote
0answers
48 views

Genetic Algorithm Typescript

I learnt a little about genetic algorithm. And I made a program from typescript that tries to evolve and match word/sentence using genetic algorithm. But if I give a little longer sentence it takes ...
2
votes
2answers
54 views

Blog API implementation in node.js

This code is from my blog project. This project is almost done. This is working well. I can create new posts and update and display all saved posts. ...
1
vote
1answer
108 views

Is My Controller too Coupling?

To put it in context, I had the assignment to do for a job interview in Node.JS, which basically making CRUD with products (and it have certain conditions). The assignment was well-understandable, and ...
2
votes
1answer
62 views

Web-browser Tic-Tac-Toe game

I have made the tic-tac-toe game as part of The Odin Project course. I think the code I have written just works but is not properly optimized for performance and it could be made simpler. This is ...
0
votes
1answer
44 views

Function that decodes all values of a given object from Base64

I have function decodeVals in NodeJS that decodes all of the values of the given object from Base64 to ASCII. This is achieved by traversing the values of said ...
5
votes
3answers
726 views

Employee Model definition without an ORM

I am the author of this code. It's from an actual project, and it returns the desired result. However, I am very concerned that I'm not defining my Model correctly. The Model is instantiated in the ...
3
votes
2answers
63 views

Javascript best way to filter out empty values and simplify reusable function

Hello I have this function that takes array of objects and takes a specific value from the object and creates array of strings that can make mapped to dropdown selector. ...
1
vote
3answers
94 views

Is this node.js class returning a json

...
2
votes
1answer
74 views

TypeScript, React and Node app to get 'games' data from a database and display them on a frontend

This is only one of the first apps I've built with Node, React and TypeScript. I was wondering what could be made better. This is at this point the best I've been able to come up with, but I'm not ...
0
votes
0answers
50 views

Commands loader

Loader - load commands files(classes) from directory of commands and module, if the commands are very simple and similar, then I put them in 1 file with the name of the module and load them through ...
3
votes
1answer
169 views

Sanitation and validation of a user input 10 digits phone number

phoneNumberCheck() is using 2 helper function to check if a users input of a phone number is valid. this is a client side check, if this code is ok should I check the same at the nodeJS back end? is ...
1
vote
1answer
31 views

Node.js Service Registry

...
1
vote
0answers
16 views

Calling promise-returning function within promise-returning function

I am rather new to JavaScript and never really worked with promises before. My code works but I would like to learn if there is a better approach? I want to implement the following functionality: ...
0
votes
0answers
7 views

A recent activity github action written in node.js

I and Abishek Joshi forked a repo, and improved a lot of code in it and published it, we did that because that original repo was last commited on 2020 december. For more info on history you can visit ...
12
votes
1answer
1k views

Simple NAPI wrapper around self written C++ msgpack, horrible performance

I have written a relatively small msgpack implementation in C++, with performance that is not too bad, so I decided to write a NAPI wrapper around it, but the performance is just horrible. I am ...
1
vote
1answer
35 views

Is this file a good starting point for accessing data inside this json file via javascript classes?

I was given a spreadsheet of data that I turned into a CSV file and then converted it into a JSON file. I threw it into my application and I am processing it in the following manner: ...
0
votes
1answer
95 views

This code renders a time dilation calculator

I've been learning React for about a month now. I wrote a small interactive calculator to show the effects of time dilation under special relativity. It's Node/React/Razzle(for SSR)/Typescript/...
2
votes
0answers
44 views

Right structure, three-layered architecture webdevelopment

My question is have i gotten the three-layered architecture right with error handling etc. I have a webpage containing different resources. The code works but I am not sure if have structured it ...
2
votes
1answer
66 views

Generating a performance report for clans in Clash Royale

The following code generates a report showing performance of clan members in a game called Clash Royale. Everything is pretty self-explanatory, we are working with a lot of https requests, arrays and ...
3
votes
1answer
134 views

Node backend to run user-submitted code in a virtual machine

As per the title, I'm making a webapp that is intended to use as a JS exercise platform. Problems are shown to users, they submit code, that code is run against a few test cases, and a report of the ...
0
votes
2answers
218 views

Generate all possible unique combinations of positive numbers these have sum equal to N

This is my function to generate all possible unique combinations of positive numbers these have sum equal to N. For example: If the input is 4 The output should ...
0
votes
0answers
52 views

Command Line Utility to Delete Files/Directories

del-files Delete files and directories from the command line. https://github.com/sarthakgaur/del-files Installation ...
0
votes
0answers
17 views

Create conversations and add new members while avoiding duplicates

In a Node app where there is a messaging service, I've added a method to add a conversation and a member. The method functionality is that when a new request hit an API for messaging, that calls a ...
8
votes
2answers
176 views

JSON4 parser in Typescript

Context I may have accidentally gotten a little sidetracked during homeschooling, and wrote a JSON4 parser in Typescript during the down-time. This project started as an idea that I got while ...
2
votes
0answers
53 views

Cron expression parser

Problem Write a command line application or script which parses a cron string and expands each field to show the times at which it will run. ~$ your-program "*/15 0 1,15 * 1-5 /usr/bin/find"...
1
vote
1answer
46 views

Lookup an array against another with performance

I got an initial array, I am checking against another array to find how many objects have at least one instance of the Domain in data. I wonder if there is a more ...
2
votes
1answer
124 views

Strip all comments and create a new file with only (JS) code

This code hasn't been tested exhaustively - I would love suggestions about a testing library. Critical, Optional and Positive feedback are more then welcome. ...
0
votes
1answer
157 views

Import XML files to MongoDb with Nodejs

Here is my code which will read XML files and import the data to MongoDb. Do you have any comments on my code? ...
0
votes
0answers
13 views

What are the downsides of stateful socket NodeJS server comparing to a regular stateless REST server?

I've built this NodeJS server architecture 5 years ago. The project was in production all this time, I've been maintaining it actively, adding a lot of new features, and had no troubles with this ...
2
votes
1answer
78 views

Parse proxy strings to array of objects

The goal of this module is to take in a string (user input, someone copy and pasting a large list of proxies) and parse it into an array of objects. I appreciate any and all feedback, but I'm ...
0
votes
0answers
532 views

My approach on nextjs cluster with socket.io

I'm interested in feedback on my approach to handling cluster on Next.js SSG app with express hosted on Heroku. The app is working however, please let me know if this is the wrong approach or if you ...
2
votes
1answer
106 views

Simple text adventure engine built in electron

I'm working on making a text adventure using Electron. I have the basics of the engine working, you can walk around an infinite map. Maps contain things, and you can enter a few basic commands. I'm ...
1
vote
1answer
416 views

NodeJS promise loop through all files in directory

I am trying to re-organise my mp3 collection based on its id3 meta data into folders based on the artist. I'm new to nodeJs and more importantly promises. I was hoping I could get some feedback on my ...
0
votes
0answers
32 views

Node.js html parser class

I have a simple class, called website which is able to get the html of a website (if the website html is not provided), the urls inside the website, the contents of the title, and description tag. As ...
2
votes
0answers
37 views

Tiny REST API for making CRUD operations on list of posts

This is not a question related to a bug.I've just created a very tiny node.js/express API for education purposes. I've created a very little ...

1
2 3 4 5
20