cancel
Showing results for 
Search instead for 
Did you mean: 

Bootstrap UI5 Classes into nodejs module

former_member235482
Participant
0 Kudos

Hoping to find best practice methodology to bootstrap UI5 classes into nodejs module. I do not intend to have any visible UI or xml views. I am having trouble figuring out how to bootstrap UI5 classes into my node express routes.

I found a npm package called node-ui5 that seems to do what I'm looking for However, I'm concerned with using this package in an enterprise app because it does not seem to be actively used or updated by other developers. I also don't know if I have control over the sapui5 / openui5 version that will be loaded.

Is there a way to achieve something similar to the code snippet below by using the open-ui5 npm package directly?

thomas.jung knows all, any tips would be very much appreciated.

'node-ui5' usage sample code to utilize ui5 classes:

require('node-ui5').then(({sap}) => {
  // use sap, for instance:
  sap.ui.require([
    'sap/ui/model/odata/v2/ODataModel'
  ], async function (ODataModel) {
    console.log('Creating ODataModel...')
    const model = new ODataModel({
      serviceUrl: 'https://services.odata.org/V2/OData/OData.svc'
    })
    await model.metadataLoaded()
    console.log('Loading products...')
    model.read('/Products', {
      success: data => {
        data.results.forEach(product => {
          console.log(product.Name.padEnd(20, ' '), product.Description)
        })
      }
    })
  })
})

Accepted Solutions (0)

Answers (0)