Skip to main content

All Questions

-4 votes
1 answer
403 views

Best way to structure reusable code using Node.JS, EJS, and front end JS?

I'm more or less learning the MEAN stack (have yet to start on Angular, so currently using straight vanilla JS for front-end) and part of what I'm building for my portfolio is a drag-and-drop form ...
R Greenstreet's user avatar
-2 votes
1 answer
768 views

Design pattern for a switching between APIs with no code changes

I'm trying implement in JavaScript/Node.js a data upload functionality. I want to be able to switch between different storage providers, e.g. AWS, GCP, Azure, with no code change, for instance, via ...
Mike's user avatar
  • 135
-3 votes
2 answers
363 views

Is this an anti pattern in Javascript?

A common pattern I've been using for JS/NodeJS applications is the following: import { utility1, utility2 } function exampleScript() { utility1() utility2() // Does something } Basically my main ...
bellwether's user avatar
1 vote
1 answer
54 views

JavaScript/NodeJS Class Extension vs Adding Properties

I am currently writing a Discord bot and have reached the point of needing a refactor. With this being my first stab at JavaScript/NodeJS and making a bot in general, there are a lot of mistakes I ...
BrandonM's user avatar
  • 121
0 votes
1 answer
544 views

Class definitions in static getter methods

[Node.js / CommonJS] I'm creating a single GitHub repo for my tool which has a Core, Control, Server, and Client library. It's unlikely that all of them will be used at the same time. I'd like my ...
Vic's user avatar
  • 171
9 votes
2 answers
1k views

Respectable design pattern for making node modules flexible/testable?

I am looking to get some input from some more experienced testers than what I am. :) I am trying to make my node modules testable, allowing for dependency spying/stubbing/mocking without the need to ...
ctrlplusb's user avatar
  • 193
1 vote
1 answer
2k views

Handling multiple asynchronous events - Wait for pending offers to process on new offer?

I have a programming problem, that I don't know how to solve. And while I have provided a sample of my code, I am interested in a conceptual answer on how to resolve this problem. On a tradeOffers ...
Skanker's user avatar
  • 21
5 votes
2 answers
694 views

How to avoid circular patterns in Node?

I'm new to Node and JavaScript (well, asynchronous programming in general) and I noticed when I was working on a project that the following code is a circular pattern and that these are bad practice ...
Gemtastic's user avatar
  • 151
37 votes
4 answers
8k views

The importance of Design Patterns with Javascript, NodeJs et al

With Javascript appearing to be the ubiquitous programming language of the web over the next few years, new frameworks popping up every five minutes and event driven programming taking a lead both ...
Lewis's user avatar
  • 483