Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/cds

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds

SAP Cloud Application Programming Model - CDS for Node.js

  • 7.7.2
  • npm
  • Socket score

Version published
Weekly downloads
147K
decreased by-42.03%
Maintainers
1
Weekly downloads
 
Created

What is @sap/cds?

@sap/cds (SAP Cloud Application Programming Model) is a framework for building enterprise-grade services and applications. It provides a comprehensive set of tools and libraries to develop, deploy, and manage data-centric applications. The package supports defining data models, services, and business logic, and it integrates seamlessly with SAP HANA and other databases.

What are @sap/cds's main functionalities?

Defining Data Models

This feature allows you to define data models using CDS (Core Data Services) and interact with them. The code sample demonstrates defining a simple data model for a bookshop and implementing a service to read book data.

const cds = require('@sap/cds');

const { entities } = cds.model;

const Books = entities('my.bookshop.Books');

module.exports = cds.service.impl(async function() {
  this.on('READ', Books, async (req) => {
    return [{ ID: 1, title: '1984', author: 'George Orwell' }];
  });
});

Service Implementation

This feature allows you to implement services that handle CRUD operations. The code sample shows how to implement READ and CREATE operations for a 'Books' entity.

const cds = require('@sap/cds');

module.exports = cds.service.impl(async function() {
  this.on('READ', 'Books', async (req) => {
    return [{ ID: 1, title: '1984', author: 'George Orwell' }];
  });

  this.on('CREATE', 'Books', async (req) => {
    const { ID, title, author } = req.data;
    return { ID, title, author };
  });
});

Deploying to SAP HANA

This feature allows you to deploy your CDS models and services to an SAP HANA database. The code sample demonstrates how to deploy a service to SAP HANA using the provided credentials.

const cds = require('@sap/cds');

cds.deploy('srv').to('hana', {
  credentials: {
    host: 'your-hana-host',
    port: 'your-hana-port',
    user: 'your-hana-user',
    password: 'your-hana-password'
  }
}).then(() => {
  console.log('Deployment to SAP HANA successful');
}).catch((err) => {
  console.error('Deployment failed', err);
});

Other packages similar to @sap/cds

Keywords

FAQs

Package last updated on 11 Mar 2024

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