|
пре 4 година | |
---|---|---|
.github | пре 4 година | |
.vscode | пре 4 година | |
app | пре 4 година | |
config | пре 4 година | |
test | пре 4 година | |
.autod.conf.js | пре 4 година | |
.eslintignore | пре 4 година | |
.eslintrc | пре 4 година | |
.gitignore | пре 4 година | |
.travis.yml | пре 4 година | |
README.md | пре 4 година | |
app.js | пре 4 година | |
appveyor.yml | пре 4 година | |
ecosystem.config.js | пре 4 година | |
package.json | пре 4 година | |
server.js | пре 4 година |
此项目没有修改框架,所以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;
}
see egg docs for more detail.
$ npm i
$ npm run dev
$ open http://localhost:8081/
$ npm start
$ npm stop
npm run lint
to check code style.npm test
to run unit test.npm run autod
to auto detect dependencies upgrade, see autod for more detail.