Home > Net >  Why does 'app' go as a parameter for module.exports?
Why does 'app' go as a parameter for module.exports?

Time:10-09

In my routes file, I export all code and import it at my index.js. What's the purpose of inserting 'app' as a parameter in my export statement?

module.exports = (app) => {

Thanks!

CodePudding user response:

What you are looking is a Arrow Function that accepts one argument.

This module is exporting a default function which can be imported like this

var test = require('./whatever-file');

and now test is a function.

test('a string argument')

Obviously with the little that is posted we can't infer what type app is supposed to be. So, you will need to adjust according to whatever is needed.

  • Related