Package Exports
- @loopback/rest-crud
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@loopback/rest-crud) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@loopback/rest-crud
REST API controller implementing default CRUD semantics.
Overview
This module allows applications to quickly expose a model via REST API without having to implement a custom controller class.
Installation
npm install --save @loopback/rest-crudBasic use
Define your model class, e.g. using
lb4 modeltool.Create a Repository class, e.g. using
lb4 repositorytool.Create a base REST CRUD controller class for your model.
const CrudRestController = defineCrudRestController< Product, typeof Product.prototype.id, 'id' >(Product, {basePath: '/products'});
Create a new subclass of the base controller class to configure repository injection.
class ProductController extends CrudRestController { constructor(@repository(ProductRepository) repo: ProductRepository) { super(repo); } }
Register the controller with your application.
app.controller(ProductController);
Contributions
Tests
Run npm test from the root folder.
Contributors
See all contributors.
License
MIT