This package has been deprecated

Author message:

I do not maintain this package anymore, please upgrade to loopback v4

loopback-advancedmodel

1.13.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i loopback-advancedmodel

Weekly Downloads

2

Version

1.13.0

License

MIT

Unpacked Size

29.3 kB

Total Files

4

Last publish

Collaborators

  • fraxken