본문 바로가기

안녕하세요!

SAP/CAP

[ CAP ] Getting Started

팀장님께서 과제 하나를 주셨다. 그것인 즉슨, 신입사원을 대상으로 CAP 스터디를 각자 진행하되, 매주 한 번씩 스터디의 경과와 한 두 가지 파트를 분석해 공유하는 것이었다. 따라서 현재 진행 중이던 UI5 Walk Through의 복습이 거의 다 끝났기에, CAP에 대해 다뤄보고자 한다. CDS를 핵심적으로 활용하기 때문에 굉장히 중요한 학습이 될 거 같다.

 

Getting Started


 

CAP는 Node.js와 Java를 지원한다.
이번 학습 과정은 Node.js로 진행이 되기 때문에 Java를 사용하고자 한다면
아래 링크에 접속해 진행하면 된다.

 

 

capire - Getting Started

Getting Started How to start a new CAP Java project and how to run it locally. Content Introduction The CAP Java SDK enables developing CAP applications in Java. While the SAP Business Application Studio provides excellent support to develop CAP Java appl

cap.cloud.sap


 

Node.js and SQLite


 

프로젝트를 진행하기 위해 Node.jsSQLite를 설치해준다.
SQLite의 경우, 윈도우에서만 필요하므로 참고하자.

 

 

Node.js

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

 

 

SQLite Download Page

Templates (1) and (2) are used for source-code products. Template (1) is used for generic source-code products and templates (2) is used for source-code products that are generally only useful on unix-like platforms. Template (3) is used for precompiled bi

sqlite.org


 

@sap/cds-dk


 

 

터미널을 띄워서 @sap/cds-dk를 설치해준다.
npm i -g @sap/cds-dk

 

 

이제 프로젝트를 하나 만들어서 srv 폴더를 생성하고,
cds 파일 하나를 만든다.

반응형
world.cds 파일에 코드 소르를 다음과 같이 작성한다.
service say {
  function hello (to:String) returns String;
}

 

world.js 파일을 생성한 후, 아래와 같이 코드를 입력한다.
module.exports = class say {
  hello(req) {
    let {to} = req.data
    if (to === 'me') to = require('os').userInfo().username
    return `Hello ${to}!`
  }
}

 

 

프로젝트를 실행시켜 보면 위와 같은 화면이 노출된다.

아마 예전에 다른 예시로 CAP를 해보았던 경험을 떠올려 보니,
뭔가 프로젝트 생성 과정에 문제가 있는 것 같다.
예전 게시물을 복습하면서 분석해 봐야겠다. 

 

728x90
반응형

'SAP > CAP' 카테고리의 다른 글

[ CAP ] Databases 정보 추가  (2) 2023.04.04
[ CAP ] Databases 생성하기  (2) 2023.04.04
[ CAP ] CDS 생성하기  (0) 2023.03.31
[ CAP ] MTA와 CAP  (0) 2023.03.30

loading