服务端

lrf402788946 1b94aa09e4 update readme 4 年 前
.github 8e97d3d13f 1 4 年 前
.vscode 8e97d3d13f 1 4 年 前
app 6760e6f6d7 update 4 年 前
config 476e596bee 1 4 年 前
test 8e97d3d13f 1 4 年 前
.autod.conf.js 8e97d3d13f 1 4 年 前
.eslintignore 8e97d3d13f 1 4 年 前
.eslintrc 8e97d3d13f 1 4 年 前
.gitignore 8e97d3d13f 1 4 年 前
.travis.yml 8e97d3d13f 1 4 年 前
README.md 1b94aa09e4 update readme 4 年 前
app.js 8e97d3d13f 1 4 年 前
appveyor.yml 8e97d3d13f 1 4 年 前
ecosystem.config.js dcbc36fb0a 1 4 年 前
package.json ff09715ffa 1 4 年 前
server.js 8e97d3d13f 1 4 年 前

README.md

servec-zhwl

此项目没有修改框架,所以model部分如果使用子目录,会引发错误,controller和service,router使用子目录不会产生bug

添加模糊查询:naf-framework-mongoose>lib>service>crud-service中 query和count在操作model前加上下面的代码

filter = this.turnFilter(filter);

之后添加函数 turnFilter

turnFilter(filter){

let str = /^%\w*%$/;
let keys = Object.keys(filter);
for (const key of keys) {
  let res = key.match(str);
  if (res) {
    let newKey = key.slice(1, key.length - 1);
    filter[newKey] = new RegExp(filter[key]);
    delete filter[key];
  }
}
return filter;

}

QuickStart

see egg docs for more detail.

Development

$ npm i
$ npm run dev
$ open http://localhost:8081/

Deploy

$ npm start
$ npm stop

npm scripts

  • Use npm run lint to check code style.
  • Use npm test to run unit test.
  • Use npm run autod to auto detect dependencies upgrade, see autod for more detail.