如何使node.js自动加载配置文件

时间:2016-04-15 21:01:05

标签: node.js shell command-line config configuration-files

在node.js中,您可以使用' require()' 加载你的配置文件,但我厌倦了必须在我的所有程序上这样做。有没有办法让node.js自动加载配置文件?

1 个答案:

答案 0 :(得分:0)

没关系。我发现你可以把它放在你的' .bash_profile'或者unix机器上的shell配置文件:

#ifndef TEAM_H
#define TEAM_H
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;

// definition of class Dice
class Team
{
  private:
    int numPlayers,
        winNum,
        lossNum;
        int points;
    string teamName ;

  public:
    // default constructor: initializes the face of a new
    // Dice object to 1
    Team();
    Team(const char newName, int newPlayers);
    void display(); // displays information about the team.
    void addWins(); // increment the number of wins
    void addLosses(); // increment the number of losses.
    void addPlayer(int nrPlayers);
    void delPlayers(int nrPlayers);
    void setTeam(char name[], int players, int wins, int losses);
    bool isBetter(const Team &other);
    int getWins(); // returns the number of wins for a team object
    int getLosses(); // returns the number of losses for a team object
    int getPoints(); // returns the number of points a team has
};
#endif