NodeJs : TypeError: require(…) is not a function

前端 未结 7 938
旧巷少年郎
旧巷少年郎 2020-11-27 15:27

I am trying to require a file and afterwards pass it to a var. I am following this tutorial to create a authentication system. After writing the server.js file and trying to

7条回答
  •  广开言路
    2020-11-27 15:56

    I've faced to something like this too. in your routes file , export the function as an object like this :

     module.exports = {
         hbd: handlebar
     }
    

    and in your app file , you can have access to the function by .hbd and there is no ptoblem ....!

提交回复
热议问题