title: Not able to export function in nodejs
body: <p>I have defined a function service in one of the file</p>
  <pre><code>import Category from '../models/Category.js';
  
  export const AllCategories = () =&gt; {
          console.log('hit');
          const cursor =  Category.find({});
          console.log(cursor);
          return cursor
  }
  
  
  export default {AllCategories}
  </code></pre>
  <p>I am importing this in the controller file</p>
  <pre><code>import express from 'express';
  import categoryService from '../services/categories.js'
  const router = express.Router();
  
  export const getCategories = async(req,res) =&gt; {
      try {
          const categoriesInfo = categoryService.AllCategories
          res.status(200).json(categoriesInfo)
      } catch (error) {
          res.status(404).json({ message: error.message });
      }
  }
  
  export default router;
  </code></pre>
  <p>But the issue is that AllCategories is not getting run, what is wrong here</p>
  <p>I also tried adding async/await</p>
  <pre><code>import Category from '../models/Category.js';
  
  export const AllCategories = async () =&gt; {
      try {
          console.log(&quot;hit&quot;);
          const cursor =  await Category.find({});
          console.log(cursor);
          return cursor
      } catch (error) {
         return error 
      }
  }
  
  
  export default {AllCategories}
  </code></pre>
  <p>But still no luck</p>