Personally, we are fans of TypeScript
and recommend using it for most applications. However, if you prefer using plain JavaScript
, we recommend looking at step 4.
The main differences you will notice between TypeScript
and JavaScript
are the type annotations and module definitions - ES6 modules in TypeScript
vs. commonJS
modules in JavaScript
. To migrate a TypeScript
file to JavaScript
, you only need to change the file extension from .ts
to .js
, remove all type annotations and change the import
s and export
s.
To create an application that already contains all the files and configuration you need to use the SAP Cloud SDK for JavaScript, you can use SDK’s command line interface (CLI). To get the CLI, run the following command:
npm install -g @sap-cloud-sdk/cli
This will install the CLI globally on your machine, allowing you to use it anywhere.
Now you can create a new project by running the CLI’s init
command:
sap-cloud-sdk init my-sdk-project
Since the target folder is empty, the CLI will ask you whether a new nest.js
project should be initialized. Answer with y
and subsequently accept the suggested project name. The CLI will already install all the necessary dependencies for the project, so this might take a minute. If everything worked correctly, you should see output like this:
+---------------------------------------------------------------+
| ✅ Init finished successfully. |
| |
| 🚀 Next steps: |
| - Run the application locally (`npm run start:dev`) |
| - Deploy your application (`npm run deploy`) |
| |
| 🔨 Consider setting up Jenkins to continuously build your app |
| Use `sap-cloud-sdk add-cx-server` to create the setup script |
+---------------------------------------------------------------+