Skip to main content

All Questions

3 votes
1 answer
117 views

Consuming sharded database using node.js

I think the only big improvement that can be made is to check which shard to query based on the userIds of the followed users. One easy way is to check the last ...
user avatar
2 votes
1 answer
91 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
3 votes
0 answers
59 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 ...
PreKaGit's user avatar
4 votes
1 answer
163 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
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
6 votes
1 answer
644 views

Any better pagination logic?

router/article.js ...
viviet's user avatar
  • 63
1 vote
1 answer
156 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
  • 771
2 votes
0 answers
73 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
7 votes
1 answer
353 views

How do I refactor this fetch request?

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
2 votes
1 answer
120 views

Performance and login security for NodeJS using Express with Express-sessions

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
420 views

Mern stack app on error handling, async await, try-catch and avoiding DRY in controller functions

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
1 answer
114 views

Correct way to unit-test express API

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
256 views

NodeJS - Auto Module Loader

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
0 votes
1 answer
60 views

Registering a user and login

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
87 views

API using NodeJS to recive data from client and send it to a server

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

15 30 50 per page
1
2 3 4 5
9