1

我在 Node.js 中有一个路由器的获取请求处理程序,它有很多代码:

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;

如何将其拆分为小函数并从路由器调用这些函数?

4

0 回答 0