Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

A loopback mixin to automatically generate POST method for models

License

Notifications You must be signed in to change notification settings

IBMResearch/loopback-post-mixin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

Use loopback-ibmresearch-mixin

Generate POST methods for Loopback Models

This module is designed for the Strongloop Loopback framework. It automatically adds POST method for any Model.

Installation

You can put me in your package.json dependencies. The npm tool can do this for you, from the command line:

$ npm install --save loopback-post-mixin

Configuration

assignProperties will be assign properties instead of merge.

model-config.json

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-post-mixin/lib",
      "../common/mixins"
    ]
  }
}

Model config

To use with your Models add the mixins attribute to the definition object of your model config.

  {
    "name": "Widget",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "mixins": {
      "PostMethod" : {
        "assignProperties": false
      }
    }
  }

LICENSE

MIT License

Copyright (c) 2016 IBM Research Emergent Solutions

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MIT

About

A loopback mixin to automatically generate POST method for models

Resources

License

Stars

Watchers

Forks

Packages

No packages published