用README.md代替shuoming
数据库中的models和collections分别代表什么?以mysql为例,ORM中的
如何创建API
集成测试:单元测试的逻辑扩展
/
api/
bin/
collections/
config/
controllers/
env/
lib/
models/
public/
routes/
test/
views/
.gitignore
.jshintrc
app.js
package.json
README.md
README.md
- 项目名和描述
- 软件要求
- 依赖
- Getting started instructions
- 需求配置
- 任务命令
- 风格指南
- 应用架构
- 路由/API
- License信息
./models/mymodel.js
// get config
var config = require('../config');
// connect to the database
var Bookshelf = require('../lib/dbconnect')(config);
// define model
var myModel = Bookshelf.Model.extend({
tableName: 'items'
});
// export collection module
module.exports = myModel;
./collections/mycollection.js
//require the model for this collection
var myModel = require('../models/mymodel');
// define collection
var myCollection = Bookshelf.Collection.extend({
model: myModel
});
// export collection module
module.exports = myCollection;
./controllers/items.js
./routes/items.js
./config
./env
网友评论