cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use CAP node js to deploy OData service outside of BTP?

EkanshCapgemini
Active Contributor
0 Kudos

Hi,

I am developing an app using UI5 and it is not connected to SAP systems or BTP etc.. The app has no connection to SAP whatsoever. I am using UI5 as I am most familiar with this frontend framework and can wrap the app quicker than other frameworks.

For backend, I would be using postgres and was thinking to create an OData service on top of it. I can use the normal REST API based calls in UI5 with JSON model but I wanted to use the functionalities provided with OData model. For this purpose, can I use CAP to create OData service and deploy it on a normal EC2 instance serving the APIs with express?

Could you please help me in this regard?

BR, Ekansh

junwu
Active Contributor
0 Kudos

why bother to use cap in your case?I believe there are lot of other odata framework on node js platform.

EkanshCapgemini
Active Contributor
0 Kudos

There are a very handful of odata frameworks on server side for nodejs. There are various challenges in using those:

  • not matured enough
  • no support to custom annotations
  • learning curve as only 1 or 2 use express.js
  • I am already familiar with CAP and UI5
vobu
Active Contributor

yes, this is possible. only limitation i can think of is authorization and authentication: the std CAP mechanisms will not apply in a non BTP scenario - so you‘ll have to roll your own, like Leo showed here: https://www.js-soft.com/recap-2021/ „Orchestration of micro frontends…“

more details:

- use mtar deployment only if your target stack runs on cf

- otherwise deploy every component separately - you’ll have 1 UI package and 1 CAP package; then use the UI5 simpleproxy middleware to connect to the CAP layer

- use cds-pg to plug CAP into postgres; it can connect to any pg instance reachable via tcp. Also the new cds-pg currently in dev will retain that feature.

Already 2021 one summary of the reCAP (un)conference was that „there is no reason not to run CAP outside SAP“ 🙂

Once you have your setup going, hand in a CfP and talk about it at the upcoming reCAP!

EkanshCapgemini
Active Contributor
0 Kudos

Thanks vobu. It is really helpful. I'll give it a try.

Accepted Solutions (0)

Answers (2)

Answers (2)

WouterLemaire
Active Contributor

in theory I think yes but not with hana as a database. With postgresql it should be possible. I didn’t do this myself yet…

EkanshCapgemini
Active Contributor
0 Kudos

Hi Wouter,

If possible, can you please point me to some documentation regarding the deployment outside of BTP and without hana as db? All I could find in the CAP documentation was to deploy on BTP.

To use with postgresql, I am planning to use the .on method to implement the db interaction myself using prisma or supabase libraries. This is a little tricky scenario as not much is available on internet or atleast I couldn't find such.

BR, Ekansh

junwu
Active Contributor
0 Kudos

mtar deployment is not sap specific, as long as you can find cloud foundry, I think you can deploy it.

anyway, inside mtar, just some node js app, if you have some understanding about node js, you can start it by your self. only db part, I am not sure if it can run non-hana db.

MustafaBensan
Active Contributor
0 Kudos

Hi Ekansh,

jun.wu5 makes a very valid point. It seems like you are still going to need to invest some time and effort to work out how to integrate Postgres with CAP on a non-BTP stack. That being the case, why not take this as an opportunity to step out of your comfort zone and explore upskilling beyond UI5 and CAP to other tech stacks?

Regards,

Mustafa.

EkanshCapgemini
Active Contributor
0 Kudos

Hi,

I ain't afraid of learning the other stack. In fact, I'm all in for that but the short answer for the above question is very short client deadline. 🙂

Integrating with postgresql wouldn't be a challenge as I would use supabase sdk, Deployment is the challenge.

I am anyways evaluating my options and in one corner of my heart, I know that I won't be able to deploy cap outside of btp. It would have provided some relief, if I could've used some smart controls which aren't possible with json model.

Br, Ekansh