Any reason not to pass request / response as a parameter?

In express I have a handler for a route ex:

router.get(`${api}/path/:params/entrypoint`, routeHandler);

In this example 'routeHandler' function has a lot of logic doing various things. I'd like to break 'routeHandler' into smaller methods to ease readability and testability. So instead of:

routeHandler(req, res) {
    //many lines of code

We could have:

routeHandler(req, res) {
    helperOne(req, res);
    helperTwo(req, res);

helperOne(req, res) {
//do stuff

helper2(req, res) {
//do stuff

I am being told not to do this by a coworker who is pretty senior, but I do not understand why. Does anyone know of any issues that can arise by passing the response or request objects into helpers? I can not think of any and google isn’t revealing any clear answer.


#javascript #node-js #express

What is GEEK

Buddha Community

Watts Kendall


Yes you may run into some problems when passing those parameters, especially res. For example you may res.send multiple times (one in each function) which will raise an exception.


A more concrete example is this

routeHandler((req, res) => {
    helperOne(req, res);
    helperTwo(req, res);

Based on some conditions, I want to stop and return an error from helperOne and not go execute any code from helperTwo. My definitions of these functions are like this

helperOne = (req, res) => {
    const dataPoint = req.body.dataPoint; // a number for example
    if (number > 10) {
        return res.send("This is not valid. Stopping here...");
    } else {
        console.log("All good! Continue..");

helperTwo = (req, res) => {
    res.send("Response from helperTwo");

Then let’s say I do have req.body.dataPoint = 10, and I’m now expecting my routeHandler to stop after the return res.send in the first block of my if statement in helperOne.

This will not work as expected though, because the return will concern only helperOne which is the returning function. In other terms it won’t propagate to routeHandler.

In the end an exception will be raised because routeHandler will call helperTwo and try to send a response again.


  • Don’t send req or res. Just pass the data you need and handle the reponse in your mainhandler
  • An even better alternative is to use Express middlewares. Since you have multiple *“sequential”*handlers, you can chain multiple middlewares, which is closer to the standard Express.JS way
Tyrique  Littel

Tyrique Littel


Is Java “pass by value” or “pass by reference” ?

Friends , in this article I’ll be explaining about whether Java uses pass by value or pass by reference ? After reading this article you will be able to grasp the concept about pass by value and pass by reference .While reading this article try to focus on example codes and associated comments .

Java is always pass by value and not pass by reference .

What does pass by value actually mean ?

As the name says , pass by value simply means , we pass the value of an Object and not actual/original reference variable of an Object from main function to the called function but the copy of reference variable of this object is passed to the called function which ultimately points to same object .

#pass-by-value #pass-by-reference #pass-by-value-in-java #pass-by-ref-vs-value #pass-by-reference-in-java

Udit Vashisht


Requests Python 3 - Download Files (Free books) with requests-html and requests Python 3

In this video, we will use requests python 3 and requests-html to download pdf files from Springer’s Website.
Recently, I came across a list of 408 free books available for download from Springer’s website.
So, I have created this script in which I have used requests python and requests-html to download the files.

#request-html #requests #requests-python #webscrapping #springer

Greatest Reason Bitcoin Passes $60,000 (2021 Bitcoin Bull Run Not Over)

Around the Blockchain is your favorite Cryptocurrency show discussing Bitcoin, Ethereum, Cardano, and the top altcoins. Our four crypto experts include CryptoWendyO, Blockchain Boy, Arcane Bear, and Ben Armstrong. Tune in for their insightful crypto analysis!

Today we’ll be discussing Millennials’ increasing power in the investment realm. We are talking about Africa possibly following El Salvador’s footsteps with Bitcoin adoption. Finally, we reveal some very bullish news for Bitcoin and Ethereum.
📺 The video in this post was made by BitBoy Crypto
The origin of the article:
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #bitcoin bull #greatest reason bitcoin passes $60,000 #greatest reason bitcoin passes $60,000 (2021 bitcoin bull run not over) #2021

Mobile Responsive Web Design

Mobile responsive website design will make your site mobile-friendly, improve the way it looks on devices with both large and small screens, increase the amount of time that visitors spend on your site and help you improve your rankings in search engines.

Contact now to Get the best website design services at a reasonable price from Skenix Infotech.

#responsive web design company in india #responsive web design services #hire web designer #mobile responsive design #responsive web design #mobile web design

10 Responsive Web Design Challenges And Their Solution

Even though your website works perfectly on a desktop, doesn’t mean it’ll render perfectly on mobile or tablets as well. With the plethora of devices available, you’re bound to miss out a few crucial ones, and hurt your users’ experience. Optimising your website for every single device seems like a daunting task, but what if i told you that you don’t have to do it!

All you need to do is make sure that your website has responsive web design, i.e your content adjusts to different devices automatically, and you’re good to go. But, it is easier said than done, even while making your website responsive, you’re bound to face certain challenges on the way.

In this article on responsive web design, I’ll explore the challenges faced with responsive web design to ease out the process for you. Also, I’ll also explain how to transition to responsive web design and why you should go for it? So, hold on to your seats, coz you’re in for a ride!

What Is Responsive Web Design?

Image for post

responsive design-google

Responsive Web Design is the design approach where you make sure that the web pages automatically adjust to the different view ports they are being accessed on. In simpler terms, it means making web pages that look great on all devices.

While making your website responsive, you have to ensure that all the elements automatically scale in accordance with the screen size and resolution. This makes sure that all the different users accessing your website using different devices gets a seamless user experience.

Why Should You Go for Responsive Web Design?

#responsiveness #responsive-web-design #web-development #responsive-design #web-design