用README.md代替shuoming
數(shù)據(jù)庫中的models和collections分別代表什么?以mysql為例,ORM中的
如何創(chuàng)建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