Adding database relations

Now that we already have our configured endpoints, we need to create the relationship between the application models.

Our feedback will be inserted into a particular type of product, in this case, our motorcycle example, then each motorcycle model can receive various feedbacks. Let's see how simple it is to create the relationship between the models by directly editing the source code:

  1. Open common/models/motorcycle.json and add the following highlighted code:
     { "name": "motorcycle", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "properties": { "image": { "type": "string", "required": true }, "make": { "type": "string", "required": true }, "description": { "type": "string", "required": ...

Get Node.js 6.x Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.