2017-04-27 60 views
0

我正在開發一個node.js項目,其中很多模塊需要配置文件。目前我需要每個模塊中的配置文件,這是做這件事的最好方法嗎?我曾經想過將配置設置爲全局配置,但看起來很「髒」。 下面是現在的文件(不介意的結構,現在,它仍然在開發中)配置文件最佳做法node.js

{ 
    "root" : "undefined", 
    "jwtAuthentication": { 
    "appSecret": "XXXXXXXXXXXXX", 
    "expiration": "48h" 
    }, 
    "authorization": { 
    "guestActions": [ "signup" ] 
    } 
} 
+1

向我們展示配置文件。 –

+0

@JoeLloyd編輯帖子 – aslad

回答

0

這是我如何設置我的項目結構:

module1 
    --controllers 
    --services 
    --middleware 
    --config 
    module2 
    --controllers 
    --services 
    --middleware 
    --config 
    shared 
    --config 
    --services 

在共享/配置我設置全局配置和特定於該模塊的模塊{i}配置。