Skip to main content

All Questions

19 questions with no upvoted or accepted answers
4 votes
0 answers
418 views

Restructure of Express CORS middleware for unit test

How should one break this component down to better perform unit test on its behaviors? Issues: Authentication middleware component makes external request. Must recognize preflight and final flight. (...
Brandon Clark'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
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
0 answers
63 views

Node/Express authenticate Google email address

Trying to set up express server that will authenticate a user's Google email before proceeding. The code below works, but is there any way to make it more elegant? The whole ...
Dan G's user avatar
  • 31
3 votes
0 answers
1k views

Redirect to previous page using Passport Facebook strategy in Express

Somehow, I couldn't redirect the user back after its authentication. I was using successReturnToOrRedirect property, but it kept sending it back to ...
A A's user avatar
  • 31
3 votes
0 answers
69 views

RESTful API for serving videos to a client

I'm building an app that serves videos to a front end client. My stack is Express/Angular/SQLite. The db doesn't hold users, only root. I'm concerned that my controllers are too hardcoded, but I'm ...
Daniel_L's user avatar
  • 176
3 votes
0 answers
1k views

Save file from request to database

I am saving (image) files to PostgreSQL database in my Node.js and Express server application. The code is used to upload user images to server (at the moment it is not restricted to image files in ...
Juholei's user avatar
  • 135
3 votes
0 answers
186 views

Beginner's To-do app with Node.js

I get the feeling the code for this to-do app is not secure. I am just a beginner, and I don't know much about coding style so do you think it is conventional/elegant? Please don't hesitate to ...
user avatar
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
2 votes
0 answers
45 views

Backend application to bookmark GitHub repository

The backend part has the following purposes. An endpoint that takes a search term and returns a list of repositories. An endpoint that allows bookmarking a repository by its id. An endpoint to get all ...
Naveen Chand's user avatar
2 votes
0 answers
115 views

Writing error handling and users routing for my JSON RESTful API

I'm currently making an app for my side project and I was looking to get some insight on the main js file, what can I improve, the error handling, what am I doing wrong, etc. I'm mostly confused about ...
Anthony's user avatar
  • 21
2 votes
0 answers
91 views

Create a stream request for Transaction history by client id on Braintree vault

I have been trying to create a transaction history request from Braintree using a client ID on Braintree vault, and it took far too long to figure out how, so here is the code on server that I ...
JonoD's user avatar
  • 21
2 votes
0 answers
2k views

Creating a logger that wraps around winston and express-winston

I am trying to create a logger wrapper around winston and express-winston (enables middleware error log) that is configurable . How could i improve this code? //logger.ts ...
NewtonCode's user avatar
2 votes
0 answers
2k views

Passing sessions from express+passport to socket.io

I'm a node beginner and I'm trying to write fewer lines of code by finding out which lines are redundant. ...
Omorhefere imoloame's user avatar
2 votes
0 answers
129 views

JavaScript Node/React web developer interview code part 2 RESTful API

I recently applied for a job as a Node/React developer. I'm attempting to cross over from a research position to web development. I didn't get the job but all the feedback I got was that my code was ...
user1170304's user avatar

15 30 50 per page