loopback-component-templates
Define complex data templates for loopback models
Last updated 4 years ago by beeman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install loopback-component-templates 
SYNC missed versions from official npm registry.

loopback-component-templates

Greenkeeper badge Define complex data templates for loopback models

Circle CI Dependencies Coverage Status

Installation

  1. Install in you loopback project:

npm install --save loopback-component-templates

  1. Create a component-config.json file in your server folder (if you don't already have one)

  2. Configure options inside component-config.json. (see configuration section)

{
  "loopback-component-templates": true
}

Usage

  1. Define a template config on a Model._templates property.

  2. 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

Current Tags

  • 1.2.1                                ...           latest (3 years ago)

13 Versions

  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.10                                ...           4 years ago
  • 1.1.9                                ...           4 years ago
  • 1.1.7                                ...           4 years ago
  • 1.1.6                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (23)

Copyright 2014 - 2017 © taobao.org |