What is Entity Factory
Features
Installation
npm install --save @entity-factory/coreExample
// index.js
const { EntityFactory } = require('@entity-factory/core');
const { UserBlueprint } = require('./UserBlueprint');
const { PostBlueprint } = require('./PostBlueprint');
const entityFactory = new EntityFactory({
// blueprints can be an array of glob patterns, blueprint classes and/or blueprint instances
blueprints: [UserBlueprint, PostBlueprint],
});
// Generate entities
entityFactory
.for('user') // get builder instance for 'user'
.state('with-posts') // generate users with posts
.create(3); // generate 3 users with incrementing id'sLast updated
Was this helpful?