How can I delete a model in strongloop's loopback.io?
I have seen somewhere command called persistedModel.destroy()
but when I exectute slc persistedModel.destroy()
I get command not found error.
A remote method is a method of a model, exposed over a custom REST endpoint. Use a remote method to perform operations not provided by LoopBack's standard model REST API. Note: The easiest way to define a remote method is by using the command-line remote method generator.
When we talk about LoopBack, we're usually talking about rapid API generation. But behind the REST APIs is a full object-relational mapping (ORM) system that enables you to do all the standard create, read, update, and delete (CRUD) operations in your Node.
In LoopBack 4, the layer responsible for this has been separated from the definition of the model itself, into the repository layer. A Repository represents a specialized Service interface that provides strong-typed data access (for example, CRUD) operations of a domain model against the underlying database or service.
Delete /common/models/your-model.js
and /common/models/your-model.json
, then delete the lines referencing your model in /server/model-config.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With