1.13.0 • Published 5 years ago

loopback-advancedmodel v1.13.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Loopback-advancedmodel

version Maintenance MIT dep size Known Vulnerabilities

Improved model component for Loopback version 3.x

Features

  • Async & Await support
  • Register multiple validators on one property at once.
  • Better generic errors handler.
  • Object-oriented descriptor for OpenAPI (Swagger 2.0).
  • Basic ACLs management support

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i loopback-advancedmodel
# or
$ yarn add loopback-advancedmodel

Usage example

Setup your loopback project as usual and then start writing a new model (for example User).

Require the advancedmodel class from the package and use it as follow :

const advancedmodel = require('loopback-advancedmodel');

// Create your User Model
const User = new advancedmodel().disableAllMethods();

async function sayHello() {
    return "hello world!";
}
// Register the Asynchronous method sayHello on User model and Get the OpenAPI Descriptor Object.
const OpenAPIDescriptor = User.registerRemoteMethod(sayHello);

// Setup classical OpenAPI informations about our REST Endpoint.
OpenAPIDescriptor.get('/sayHello').returns({ type: 'string' });

// Export the User model
module.exports = User.export();

API

Find all documentation on the wiki section right here

License

MIT

1.13.0

5 years ago

1.12.1

5 years ago

1.12.0

6 years ago

1.11.1

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.0

7 years ago

1.8.2

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago