Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Define a remote method on a LoopBack model

    loopbackLoopback
    ^3.0.0

    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.