1

I have a get request handler of a Router in Node.js and it has a lot of code:

const express = require("express");
const router = express.Router();


router.get("/api/employees/employee-response", async (req, res) => {
  try {

     // First action with code 

     // Second action with code 

     // Third action with code 

  }


catch(exp) {

  // ...
}



module.exports = router;

How can I split that into small functions and call those functions from the Router?

Andrew Myers
  • 2,754
  • 5
  • 32
  • 40
JAN
  • 21,236
  • 66
  • 181
  • 318

0 Answers0