Configuring CNPM - Base Case




下面给出一个样例配置:

JavaScript

module.exports = {

    enableCluster: true,

    database: {

        db: "snpm",

        username: "username",

        password: "password",

        dialect: "mysql",

        host: "127.0.0.1",

        port: 3306

    },

    enablePrivate: false,

    admins: {

        xadillax: "[email protected]"

    },

    syncModel: "exist",

    nfs: require('upyun-cnpm').create({

        bucket: "your bucket",

        oprator: "your id",

        password: "your secret"     scopes: [ '@cheniu', '@strain', '@strain-f2e' ],

    }),



    badgeSubject: 'snpm', privatePackages

    : [ 'snpm' ]

}; $ npm install --save -d upyun -cnpm At this time, your package.json has changes that are inconsistent with the source Repo. If it is a Git clone user, please pay attention to possible conflicts when upgrading and updating the system in the future. Here are some official NFS plug-ins: upyun-cnpm: a plug-in that exists in the package ontology and has a cloud; fs-cnpm: a local plug-in exists on the package ontology ; sfs -client: a SFS (Simple FIle Store) plug-in exists on the package ontology; qn -cnpm: The package ontology has a Qiniu plugin; oss-cnpm: The package ontology has an Alibaba Cloud OSS plugin. In the future, if some new plug-ins come in, it may not be updated here. Please go to NFS Storage Wrappers to get the latest NFS plug-ins. Initialize the database If you are using SQLite, the database is automatic, you can ignore this step. Other databases need to import the initial database structure by themselves. The initial database script is in docs/db.sql, you can use some GUI tools to import the data, or you can directly enter the command line to import. For example, if you are using MySQL, you can operate MySQL locally.







































$ mysql -u yourname -p

mysql> use cnpmjs;

mysql> source docs/db.sql to start



the service After completing the configuration, you can start the service directly. Simple startup The easiest way is the one I'm using now, which is to execute the entry file directly with node. $ node dispatch.js 1 $ node dispatch.js Actually, I execute the above command in tmux. The official script starts some other official commands, such as you can use NPM's script to run. $ npm run start 1 $ npm run start In CNPM, npm script has the following commands : npm run dev: start in debug mode; npm run test: run test; npm run start: start CNPM; npm run status: view CNPM startup Status; npm run stop: Stop CNPM.







































Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327095769&siteId=291194637