How can I group and export multiple functions in nodejs?
I am trying to group all my util functions in utils.js:
async function example1 () {
return 'example 1'
}
async function example2 () {
return 'example 2'
}
module.exports = { example1, example2 }
And then be imported in home.js:
import { example1, example2 } from '../utils'
router.get('/', async(ctx, next) => {
console.log(example1()) // Promise { 'example 1' }
})
I thought I would get 'example 1'
for the test case above?
Any ideas?