dewdad / cloud-cap-samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to cap/samples

Find here a collection of samples for the SAP Cloud Application Programming Model organized in a simplistic monorepo setup. → See Overview of contained samples

REUSE status

Preliminaries

  1. Install @sap/cds-dk globally:

    npm i -g @sap/cds-dk
  2. Optional: Use Visual Studio Code

Download

If you've Git installed, clone this repo as shown below, otherwise download as ZIP file.

git clone https://github.com/sap-samples/cloud-cap-samples samples
cd samples

Setup

1) Get cap/samples and have them served through a local mock npm registry:

git clone https://github.com/sap-samples/cloud-cap-samples samples
cd samples
npm install
npm run registry

Keep that running while running npm commands, referring to @capire/... packages.

2) Start a sample project somewhere in a second terminal:

cds init sample
cd sample
npm i
# ... run the upcoming commands in here

Run

With that you're ready to run the samples, for example:

cds watch bookshop

After that open this link in your browser: http://localhost:4004

When asked to log in, type alice as user and leave the password field blank, which is the default user.

Testing

Run the provided tests with jest or mocha, for example:

npx jest

While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.

Serve npm

We've included a simple npm registry mock, which allows you to do an npm install @capire/<package> locally. Use it as follows:

  1. Start the @capire registry:
npm run registry

While running this will have @capire:registry=http://localhost:4444 set with npmrc.

  1. Install one of the @capire packages wherever you like, for example:
npm add @capire/common @capire/bookshop

Code Tours

Take one of the guided tours in VS Code through our CAP samples and learn which CAP features are showcased by the different parts of the repository. Just install the CodeTour extension for VS Code. We'll add more code tours in the future. Stay tuned!

Get Support

Check out the documentation at https://cap.cloud.sap. <br> In case you've a question, find a bug, or otherwise need support, use our community to get more visibility.

License

Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

About

License:Apache License 2.0


Languages

Language:JavaScript 85.3%Language:HTML 12.9%Language:Dockerfile 0.8%Language:TypeScript 0.8%Language:Shell 0.2%