🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

tong-demo1

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tong-demo1

用于演示的demo

latest
npmnpm
Version
0.0.6
Version published
Weekly downloads
13
1200%
Maintainers
1
Weekly downloads
 
Created
Source

1. 模块用途

用于演示的demo

2. 模块涉及的api列表

POST /v1/tong-demo1/async-demo async,await使用demo GET /v1/tong-demo1/hello hello demo POST /v1/tong-demo1/updateShare 添加或修改分享信息

3. 模块的使用方案

3.1. 安装

npm install tong-demo1 --save

3.2. 配置

清单3.1: /config/config.js

module.exports = {
    getConfig:function(env){
        
        let svr = require(`./${env}/server.json`);
        let db = require(`./${env}/db.json`);
        let log = require(`./${env}/log.json`);
        let fileWhiteList = require(`./${env}/fileWhiteList.json`);

        return{
            "server":svr,
            "customConfig":{
                fileWhiteList:fileWhiteList
            },
            "plugins":{
                "light-api-log":log,
                "light-api-mysql":db.mysql,
              
            }

        }
    }
}

清单3.2: /config/${env}/sever.json

{
    "port":9000,
    "documentation":true
}

清单3.3: /config/${env}/db.json

{
    "mysql":{  
        "connectionLimit" : 20,
        "host": "localhost:3306",
        "user": "root",
        "password" :"",
        "database" :"test"
    },
    "mongoDB":{
        "servers":["localhost:27017"],
        "defaultDB":"portal",
        "otherDB":["live","log"],
        "fileDB":"service_system",
        "fileColPrefix":"file",
        "poolSize":10
       
    },
    "redis":{
        "sentinels":["lcoalhsost:26379"],
        "name": "mymaster",
        "cache":true,
        "mq":false,
        "channels":["gho","kml","ghol"]
    }
}

清单3.4: /config/${env}/log.json

{
  "appenders": [
    { "type": "console"},
    {  "type": "dateFile",
       "filename": "/tmp/logs/tong-demo1-service",
       "alwaysIncludePattern": true,
       "pattern": "-yyyy-MM-dd.log"
     }
  ],
  "replaceConsole": false,
   "level": "info" 
}

清单3.5: /config/${env}/fileWhiteList.json

[
".png",
".jpg",
".gif",
".jpeg",
".plist",
".apk",
".ipa",
".zip",
".p12",
".mobileprovision",
".keystore"
]

3.插件使用

提供本模块的插件及插件的配置

FAQs

Package last updated on 09 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts