In this lesson you will learn what a LoopBack model is, you will create a Product model using the LoopbBack CLI. The product model will be based off the built-in PersistedModel which gives it basic functionality like Create, Ready, Update, Delete and some more. Using the API Explorer you can interact with the new model, store, retrieve, edit and delete the product data.

Create a REST API model:

lb model

Give the information needed, it can generate all the rest api.

There are few files will be created.

common/models/[model_name].js

common/models/[model_name].json

There is one file will be modified:

server/model-config.json:

  "Product": {
"dataSource": "db",
"public": true
}

So if you want to remove the model, you can delete those generated stuff.

If the data are stored in memory, it means once you restart the server, the data will lost, one way to keep the data for development:

datasources.json:

{
"db": {
"name": "db",
"connector": "memory",
"file": "db.json"
}
}

Add "file" prop, it will store data inside the db.json.

最新文章

  1. 在页面的el表达式是如何判断null的
  2. angular单元测试与自动化UI测试实践
  3. Alpha阶段第一次Scrum Meeting
  4. 二维树状数组 BZOJ 1452 [JSOI2009]Count
  5. IE8浏览器不能识别CSS伪类的解决办法。
  6. spring事务学习(转账案例)(一)
  7. Openstack的dashboard开发之【浏览器兼容性】
  8. chrome 远程调试(转)
  9. leetcode第一刷_Word Ladder II
  10. sqllog 8.32 注册码
  11. MVC-03 控制器(2)
  12. MailTest
  13. Memcache+cookie实现模拟session
  14. Python扩展模块——自动化(testlinkAPI的使用)
  15. 让Oracle 大小写敏感 表名 字段名 对像名
  16. jersey在 spring boot 添加 packages 扫描路径支持
  17. [Inside HotSpot] Visual Studio2017编译调试openjdk12
  18. [dev][crypto][strongswan] 有关strongswan的forward policy的源码分析
  19. 设置table的每竖的宽度
  20. __EF批量删除

热门文章

  1. 1.26 Python知识进阶 - 继承
  2. Java学习笔记六 常用API对象二
  3. wps如何输入连续的长破折号
  4. amazeui学习笔记二(进阶开发3)--HTML/CSS规范Rules
  5. 使用ILMerge将所有引用的DLL和exe文件打成一个exe文件
  6. StringBuilder类的使用总结
  7. [RxJS] How To get the results of two HTTP requests made in sequence
  8. 画pcb时丝印不能再焊盘上
  9. report_timing_requirement
  10. 9.6 Binder系统_驱动情景分析_server的多线程实现