A sample project to demonstrate how to implement a full-stack app with SAP Cloud Application Programming Model, plus SAPUI5 and TypeScript.
This public repository is read-only and no longer maintained. For the latest sample code repositories, visit the SAP Samples organization.
This sample project is a full stack application for the SAP BTP, Cloud Foundry environment that utilizes the SAP Cloud Application Programming Model (CAP) for Node.js and SAPUI5 with TypeScript.
TypeScript is a superset of JavaScript, which can essentially be described as JavaScript with syntax for types. The additionally added syntax allows a better editor integration and aims to catch errors early in development.
This project shows a full stack app entirely build with TypeScript. It is based on a basic lecture schedule scenario. The backend service features a simple data model (Rooms, Professors, Courses, Lectures) and provides data to populate a lecture schedule, which is displayed as a planning calendar on the frontend. Users can either view or manage the lecture schedule depending on the roles that are assigned to them.
UI5 TypeScript Frontend: A freestyle SAPUI5 app serves as the frontend for the project. Component, Controller, and Formatter are implemented using the perks of TypeScript. If you want to learn more about TypeScript with UI5, have a look at the following resources:
CAP TypeScript Backend: The backend service is implemented with CAP Node.js. TypeScript is used to write the service handler for the lecture service. A tsconfig.json file is used to define TypeScript compiler options and configuration. You can find more on using TypeScript with CAP here:
For a more detailed description of the sample app and takeaways when using TypeScript, please take a look at the accompanying blog post: Full Stack TypeScript App for Cloud Foundry - Sample Repository
git clone https://github.com/SAP-samples/btp-full-stack-typescript-app.git
cd btp-full-stack-typescript-app
(or download from https://github.com/SAP-samples/btp-full-stack-typescript-app/archive/main.zip)
npm install
cd app/lectures
npm install
npm run start
is for production purposes and not intended to be used on your local machine. Since TypeScript code itself cannot be executed, a transpile step to JavaScript is needed before running the project. Choose one of the following options instead to run the app.
npm run start-service:ts
The service is now available at http://localhost:4004.
npm run start-ui:ts
The UI5 app is now running on http://localhost:8080/index.html (a browser window with this URL opens automatically).
For local development with mock authentication use one of the following users to test the app:
ID | password |
---|---|
admin | initial |
viewer | initial |
npm run watch
This starts a local development server in watch mode. Changes to files (including the uncompiled TypeScript resources) are automatically detected and applied. The CAP service is now available at http://localhost:4004 (a browser window with this URL opens automatically to show the generic index.html page), and the UI5 app can be accessed at http://localhost:4004/webapp/index.html.
For local development with mock authentication use one of the following users to test the app:
ID | password |
---|---|
admin | initial |
viewer | initial |
Additional preparation steps and tools are required to deploy the application to SAP BTP, Cloud Foundry environment. For more information and guidance on the initial setup, please have a look at these tutorials and resources:
mbt build -t ./
cf login
cf deploy lecture-schedule_1.0.0.mtar
None at the moment.
This content is provided "as-is" with no other support.
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.