javascript - How to order the GET response using loopback -


i've simple model looks this:

{   "name": "reason",   "plural": "reasons",   "base": "persistedmodel",   "idinjection": true,   "options": {     "validateupsert": true   },   "properties": {     "title": {       "type": "string",       "required": true     },     "position": {       "type": "number",       "required": true     } } 

when retrieving entries, order them per default position field value. best way go this? using model hook? how it? i'm not sure implementation.

you can add default scope model so:

{     "name":        "reason",     "plural":      "reasons",     "base":        "persistedmodel",     "idinjection": true,     "options":     {         "validateupsert": true     },     "properties":  {         "title":    {             "type":     "string",             "required": true         },         "position": {             "type":     "number",             "required": true         }     },     "scope":       {         "order": "position"     } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -