Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
1 answer
654 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? ...
Steve Ngai's user avatar
1 vote
1 answer
603 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 ...
DevHigley's user avatar
2 votes
1 answer
229 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 ...
Julian Lachniet's user avatar
1 vote
1 answer
2k 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 ...
James's user avatar
  • 197
2 votes
0 answers
44 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 ...
Christian LSANGOLA's user avatar
3 votes
1 answer
67 views

New TV Episode Checker

My code checks if a new subbed episode of a TV show is out by checking the designated blog. The blogs url returns a json which is then parsed for episode number, direct video link, embed video link, ...
logicallyanime's user avatar
1 vote
1 answer
275 views

Private desktop and mobile WebSocket connections with Node.js

Background info To learn a new branch of my dev career, I've started a new project in my spare time (I've never used WebSockets before and I also want to learn more about common authentication flows). ...
htmn's user avatar
  • 218
3 votes
1 answer
90 views

Online implementation of the game "Compatibility"

This is an online implementation of a game: Compatibility. You can find the rules here. The idea is to have a browser that perform all the game's mechanics and to discuss with your friends through a ...
Pierre's user avatar
  • 265
2 votes
1 answer
389 views

MongoDB Filter between two dates

Simple code for getting documents that have a creationDate between two values in mongodb. If the user provides only one of the values the code should still work and ...
ATheCoder's user avatar
  • 123
4 votes
1 answer
159 views

Catching Errors in Factory Method with express.js

My express.js application uses a lot of promises for interacting with a variety of services. Instead of including try/catch with each one, I've setup a fail safe factory method for all my express ...
Josh's user avatar
  • 143
3 votes
2 answers
2k views

Send multiple REST requests at the same time. (node)

Below is a (very) simplified version of a function I made that creates multiple REST requests to gather needed information. Things to note: One of the REST calls is dependent upon the output of ...
Scotty Jamison's user avatar
7 votes
2 answers
1k views

Take postcodes and get the Lat long information from them

I had an interview task which was the final stage, however, the feedback I got back for my solution was that it lacked effort and structure. I would be grateful to ...
user6248190's user avatar
8 votes
1 answer
233 views

Way to delegate command to methods in different files

What I want to do is for an example command have it defined in its own file - e.g. command.js - and the same for the other methods. I want to make a separate file for every module - for example "...
roboJS's user avatar
  • 131
3 votes
1 answer
78 views

Finds customer who live within 100km and output them to a text file

I had an interview task where I had to output customers who live 100km within a particular latitude and longitude and then output them to a file with their username and ID. The customer file looks ...
user6248190's user avatar
2 votes
1 answer
65 views

Array to map based on object property containing array items

If i have a object like following ...
Saurabh Kumar's user avatar
9 votes
1 answer
429 views

Node.js backend login logic

So I wrote a rather primitive login logic in Node.js, which authenticates the user and handles JWT. Is it any good in terms of security, efficiency, building, async/sync, logging. SECURITY is my main ...
Munchkin's user avatar
  • 195
6 votes
1 answer
642 views

Any better pagination logic?

router/article.js ...
viviet's user avatar
  • 63
5 votes
1 answer
768 views

AJAX with Vanilla Node.js/JavaScript – POST JSON without a form

I am new to node.js, ajax, and asynchronous code. I’ve pieced together a working way to exchange json between browser and server and am wondering if someone with more experience considers the approach ...
Jim Thompson's user avatar
4 votes
2 answers
360 views

web scraper for emails and links

I created a class to scrape URLS, parse and validate emails and get internal links. How can I achieve the SOLID principles in this class written in Javascript to make a web scraper? ...
biel sala's user avatar
7 votes
3 answers
253 views

parse date and number from API results

I'm slurping up fields from an API that returns an array of fields. Each field in the array is a String that actually contains two separate fields (a number and a date). The number is enclosed in ...
user2402616's user avatar
2 votes
1 answer
2k views

Send message and wait for receive while using async/await and promises the proper way

I have this working code, but sendAndReceive function looks ugly/smelly to me. Eslint complains about using await inside a loop, and using ...
heltonbiker's user avatar
1 vote
1 answer
76 views

Sending HTML reports to a database project

So, I have been recently heavily focusing on Front-End, for data validation, showing errors etc. And a big thank you to CertainPerformance for many reviews hes done for me :) I have created a Report ...
DeveloperLV's user avatar
3 votes
1 answer
67 views

Node.js package that retrieves data from an API, formats it and sends it out via email to a distribution list

I've created a Node.js package that retrieves data from Icinga (a monitoring platform), formats it and passes it off to a class that generates some HTML and then sends it all out as an email. The ...
Arran Scott's user avatar
4 votes
1 answer
101 views

Netlify plugin to generate CSP rules on the fly

The following code is a Node-based Netlify plugin to generate Content-Security-Policy rules based on inline styles and scripts. Inputs ...
marcellothearcane's user avatar
2 votes
0 answers
27 views

Scalability of azure redis example

I built an auction site with a dynamic caching layer after I seeing how expensive a dbaas is. The site is now done, but like any site that grows, my caching solution grew too. The cache currently ...
user6680's user avatar
  • 121
3 votes
2 answers
421 views

Improving Async/Await Javascript Code

I'm working on a data analytics dashboard in Node.js as a portfolio piece. I've built a pipeline that gets the data where it needs to be for more processing, however, I feel the below code can be ...
BBirdsell's user avatar
  • 235
1 vote
1 answer
154 views

Basic REST API for manipularing a MongoDB collection, using Node, Express, and Mongoose

I'm practicing back-end programming and NodeJS. As an exercise, I'm attempting to build a REST API for a MongoDB collection. I'm also learning to use the Express and Mongoose middle-wares, so that's ...
NPN328's user avatar
  • 761
4 votes
1 answer
562 views

function access variable in module.exports file in nodeJs [closed]

I would like to find the best way to access function variables that are being used as parameters in other functions in another module. The parsefile.js is a Node.js ...
jacobcan118's user avatar
3 votes
2 answers
779 views

Node JS and Handlebars checking if records have been completed today

Goal: Currently creating an application using Node JS and Handlebars. I have a to do list set up in ...
DeveloperLV's user avatar
2 votes
1 answer
122 views

Is this nodejs web-application spaghetti code?

I recently interviewed for a backend developer role at a startup involved in financial products, as a 2020 grad. The take-home assignment they had me submit had a few basic goals and they recommended ...
Utkarsh Pant's user avatar
3 votes
2 answers
3k views

Javascript check if server time is greater than or less than 9am EST

I offer same day shipping if the user places an order before 9AM ET. If they place the order after 9AM, same day shipping is unavailable. My server is using UTC time so I need to check if the time is ...
Junky's user avatar
  • 163
2 votes
0 answers
71 views

Express compatible JSON Web Token authentication middleware

I am writing an Express.js middleware function in a TypeScript NodeJS project that uses a function from a third-party module to perform a small workload. When writing unit tests, I want to mock this ...
Patrick's user avatar
  • 263
2 votes
0 answers
45 views

Refactor class based approach in NodeJS

I am writing a lambda function to make a request and fetch data from API. I am using as a class based approach which I think could refactor it and write in correct way. May be we can change this class ...
user662539's user avatar
8 votes
2 answers
385 views

Serving a webpage that displays the HTTP request information sent by the client

In order to learn web server programming in Node and JavaScript, I decided to implement a simple web server that only does one thing: Display data of the HTTP request as an HTML table. The actual ...
NPN328's user avatar
  • 761
5 votes
1 answer
103 views

Converting duplicate JS code into a higher order function

I have a block of code that is re-used and I want to use functional programming to remove this duplication. My code takes an array of items, splits the items into batches of 500 and then does some ...
MSOACC's user avatar
  • 211
2 votes
1 answer
181 views

NODE JS Unlink and delete MySQL data

Here is my revised code from my other review question Node JS delete multiple MySQL linked records and delete physical file Just would like to hear some reviews if I have the right logic. ...
DeveloperLV's user avatar
2 votes
0 answers
665 views

Handling Promise that resolves but returns a 404

This is in a node and express API. I'm trying to figure out the best way to handle Promises that resolve, but return a 404 response. I have a method which uses node-fetch to make a POST call to update ...
FlameDra's user avatar
  • 151
2 votes
1 answer
93 views

d20pfsrd Discord Bot Scraper Abstraction and Deployment

I wrote a discord bot that listens for links to the d20pfsrd rulebook in discord chat, checks if they are feats or magic, and then scrapes the page, formats it, and spits it back into chat as ...
jasonmadesomething's user avatar
4 votes
2 answers
175 views

Minimal, very simple, implementation of an HTTP server for static content, using only core node.js modules

To practice the very basics of node back-end, I'm implementing the most basic server possible for static content, using only the core node modules: http fs path With the following server ...
NPN328's user avatar
  • 761
3 votes
1 answer
1k views

Node JS delete multiple MySQL linked records and delete physical file

I have the following tables in MySQL: ...
DeveloperLV's user avatar
7 votes
2 answers
342 views

Accounting for floating point error when rounding

I have to implement some business logic that will round a number (typically a double) upwards. Given that this number comes from a third-party and I don't know how they come to calculate it I'm ...
HexedAgain's user avatar
6 votes
1 answer
875 views

Nodejs async with express server

I use the following code which works as expected. The code uses open ID connect to login user. Because I'm pretty new to node and express, it will be great if I can ...
Beno Odr's user avatar
  • 119
4 votes
1 answer
273 views

Correctly using promises with node-mysql

I have been trying to do a simple query and return the results with node-mysql however I had several problems. Originally I wrote it where there was no promise, but ...
Ian's user avatar
  • 141
2 votes
2 answers
4k views

Call multiple api endpoints in NodeJS

I am new in NodeJS and I try to write code based on tutorials I find online. I have a NodeJS app (based on Strapi) and an external API from a Cloud Servers provider. The process I follow is as: Call ...
Tasos's user avatar
  • 159
3 votes
1 answer
408 views

GroupBy by nodeJS or ES6 of very nested JSON Objects with condition

The following code should return an array (flatFeatures) which will include feature.name and the most far subscription.expDate. for example if I have some subscriptions with the same features, the ...
Omtechguy's user avatar
  • 161
6 votes
1 answer
71 views

creating accounts with passportJs

I'm currently building an application using Passport and bcrypt for user authentication. I've created the registration part. Is there anything I could improve on? I'm still getting the hang of writing ...
imnewhere's user avatar
3 votes
1 answer
49 views

(Improved) get-release npm module

Improved version of the original question I've created a simple npm module and CLI program to get the latest GitHub and Bitbucket release from their APIs using Node.js. Please tell me if there's ...
user avatar
9 votes
1 answer
72 views

get-release npm module

Solved, question with improved code I've created a simple npm module and CLI program to get the latest GitHub and Bitbucket release from their APIs using Node.js. Please tell me if there's anything to ...
user avatar
3 votes
1 answer
106 views

Node JS Express - Temperature records

Goal: I have thought of a project to create and came up with this goal of: "To record temperatures for different Fridges or Freezers." Current situation I have a working method to get data ...
DeveloperLV's user avatar
1 vote
1 answer
400 views

Is this the correct way to create a route to a specific .hbs file?

This is my /forums page ...
DeveloperLV's user avatar

1 2
3
4 5
19