loopback-bootjava
boot(app, __dirname);//server.jsgit
var instructions = compile(options);
execute(app, instructions, callback); //(index.js)github
setHost(app, instructions);
setPort(app, instructions);
setApiRoot(app, instructions);
applyAppConfig(app, instructions);json
setupDataSources(app, instructions);
setupModels(app, instructions);api
async.series([
function(done) {
runBootScripts(app, instructions, done);
},app
//讀取全部server/boot/目錄下面的, (配置對應的路由與處理能夠寫在這裏)async
loopback route 處理:oop
自帶 mobile sdk:rest
//簡化了重複解析json結構的流程,直接上一個object
ModelRepository productRepository = adapter.createRepository("product"); Model pen = productRepository.createModel( ImmutableMap.of("name", "Awesome Pen") );
項目結構:server
- common
|---- models // both server and client use
- client
|---- models-config.json //view in Angular or hybrid mobile app
- server
|---- models-config.json
example https://github.com/strongloop/loopback-example-full-stack