|
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.