Become a member
to unlock all features

    Define a remote method on a LoopBack model


    In this lesson we look at extending the functionality of LoopBack models by defining a remote method.

    A remote method is a method on a model exposed over a custom REST endpoint.

    Using the lb remote-method command we will create the remote method meta-data in product.json. We will verify that this got created and that we see the new REST endpoint got added. Then we will create the actual method in product.js and enhance it so that the API will return an error if we want to buy a negative amount of products.