1.2.1 • Published 7 years ago
loopback-component-templates v1.2.1
loopback-component-templates
Define complex data templates for loopback models
Installation
Install in you loopback project:
npm install --save loopback-component-templates
Create a component-config.json file in your server folder (if you don't already have one)
Configure options inside
component-config.json
. (see configuration section){ "loopback-component-templates": true }
Usage
Define a template config on a Model._templates property.
Define the templates that generate dummy data. In this example we add a remote method called
_template_basic
to the Product model.const faker = require('faker/locale/en') Product._templates = () => ({ basic: () => ({ name: faker.commerce.productName(), description: faker.lorem.sentence(), }), })
TODO:
- Add way to create related/deep structures
- Add option to Validate template generators