la

loopback-advancedmodel

Loopback 3.X advanced Promisified model with Object-oriented API Descriptor (Support async/await)

Showing:

Popularity

Downloads/wk

1

GitHub Stars

3

Maintenance

Last Commit

2yrs ago

Contributors

1

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial