In this part, we will continue developing our XSA application with Node.js module for business logic. Please refer the Part 1 for MTA project and database HDI Module creation steps.
- Right click on the MTA project name and create Node.js module New->Node.js Module. Complete the steps in the wizard . The wizard even provides an option of XSJS support. Kindly check the same as we are going to use xsodata services.
- Once the above steps is completed, we can see the Node.js module in our project workspace with all the source files such as server.js to bootstrap xsjs, package.json created.
- As shown below , we have both HDI module(CMData) and Node.js module(MSBusinessLogic). This both module needs to interact with each other. To achieve this, we to maintain required entries in mta.yaml file. In mta.yml file, we need to mention Node.js module requires HDI module and Node.js module provide service to be used by any other module.
- Next we willl create xsodata service for the two entities created in CMData HDI module. Right click on MSBusinessLogic module and create an new file as service.xsodata under the lib folder.In the xsodata, we have defined the service to expose the entities as well as the association from Customer to Orders.Save, Build and Run the application.
- Once the application is running, we can test the xsodata service from the application URL. Metadata of service.xsodata is displayed.
- We will also create XSJS to interact with the HDI module.
Thus till now we have created MTA poject, HDI module and Node.js module. Also we have seen how the Node.js module consumes the HDI module artifacts.
Next we will create an user interface module and show how the same consumes the xsodata service provided by Node.js module.
Part 3 : User Interface Module