Socket
Socket
Sign inDemoInstall

@sap/cds-services

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-services

This package handles the generation of an OData service using the provided model. It is possible to start N services per server and each service has its own endpoint. This package also offers the possibility to register custom handlers for performing crea


Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

CDS Services

This package handles the generation of an OData service using the provided model. It is possible to start N services per server and each service has its own endpoint. This package also offers the possibility to register custom handlers for performing create, read, update and delete operations.

Overview

TBD

Prerequisites

Dependencies:

  • @sap/cds-ql
  • @sap/odata-server

Installation

npm install

Usage/Configuration

Examples

Following is an example of the service factory, which will create an OData Service:

const serviceInstance = cds.service('cat-service', {}, function() {
  this.use((req,res,next)=>{/* ... */})
})
serviceInstance.use ((req,res,next)=>{/* ... */})

OData Requests Supported by Generic Handlers

RequestDescription
POST /Employeescreate entity; if UUID key exists, UUID is generated if it is not provided
PUT /Employees(4)update entity; Complete or subset of properties, 404 if entity cannot be found
DELETE /Employees(4)delete entity; 404 if entity cannot be found
GET /Employeesread collection
GET /Employees/$countget the number of elements in a collection
GET /Employees(4)read entity; 404 if entity cannot be found
GET /Authors(4)/nameread property of entity
GET /Citations(source=1,target=3)read entity with multiple key elements
GET /Employees?$filter=birthyear eq 1980filter collection
GET /Employees/$count?$filter=birthyear eq 1980count the number of elements in a collection after applying the filter
GET /Employees?$orderby=birthyear desc,name ascorder collection
GET /Employees?$top=1read first N records of collection
GET /Employees?$top=1&$skip=2read first N records of collection after skipping M records
GET /Employees?$skip=2read collection after skipping N records
GET /Employees?$select=id,birthyearread subset of properties per entity
GET /Employees?$count=trueread collection and include the number of elements in the result set (can be combined with to-many-associations, $top, $skip, $orderby and $filter. Note that $filter will be reflected in the number of elements)
GET /Books(3)/authornavigation via managed or unmanaged to-one association
GET /Books(3)/ordersnavigation via managed to-many association (with or w/o $self)
GET /Books(3)/orders(6a48328d-55f8-4c0a-8974-433ca4421b26)/book/author/namenavigation with multiple path segments
GET /Employees?odata-debug=jsonShow debug output in json format if enabled (configurable parameter 'debug: true' when service is created)
GET /Employees?odata-debug=htmlShow debug output in html format if enabled (configurable parameter 'debug: true' when service is created)

Reference

TBD

FAQs

Package last updated on 11 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc