Not a "stupid" question.. if you dont know the answer... How to run JS code in NodeJS

@George

Im trying to wrap my head around this… I want to know how do you run JS code on your pages with Node JS?

I have watched so many tutorial on guys doing great thigs… There is 1000s of videos on youtube of guys doing NodeJs… all adding JS to the app.js or index.js…and it makes sense…they have a app.js file in the root where they add all the js… as the below video … (* from 9:35 where the ads the sdk to the apps.js file)

Now I want to do the same so I can learn how to do this…
But i guess Wappler is setup differently Can I add the JS code to the index.js file in the root?

Or would one need a different approach to do this? because this is where it goes pear shaped for me… as I cannot find a tutorial on Wappler doing the same thing? Am I just not looking at the right place? Or can you point me to a “topic” that’s doing this please?

How would one do the above (* video) in Wappler?? add some JS to make something function…

Please explain as if I’m n “monkey”!! simple words not in “nuclear physicist” terms… im trying to learn not decipher hieroglyphics…

Oh mate :smiley:

Because of the way Wappler is made, you can’t do this just like you’d do in PHP.

To run JavaScript, best thing here is:

Edit: Regarding the PayPal SDK, you’d have to build a custom extension for that, as RunJS doesn’t allow loading external modules. RunJS could theoretically do so, but JonL chose not to support it due to security concerns (risk of people not knowing what they’re doing and compromising the security of their app and then blaming Wappler)

2 Likes

Thanks @Apple… im so used to php… everbody rooted for nodejs… and im really really trying my best to get my head around it… but im not giving up… as i know with time it will come … just need guidance…

as it was the same with php in the beginning… but can do that now easy closed…

So i will ask as many “stupid” questions until i get the hang of it… because without asking im a dead fish in water…

thanks for always being such an active member and always giving valuable input.

1 Like

Do you want to run some js code on the page or in your server actions?

so basically what you saying… all the cool NPM out there… would require a custom extension module to run? i can just add that to a js page… ok … that means i would need to learn how to properly write extensions… (* hence the reason why i rooted for a extension paid platform)

Basically I want to use this nmp…

But as I now understand one would need to build a custom extension for this or am I wrong?

So doesn’t PayGate offer an API which you can use with the API Connector in Server Connect?

In theory, yes

I’m on the same boat! I still struggle creating the hjson file, I wish there was a visual builder where you could select the properties and such

According to the docs they have an api.
https://docs.paygate.co.za/#initiate

But you have to do a checksum before hand — i have done this in php…
but no clue how to do it via the API Connector… hence asking this question above npm as it all happens in there…

To unveil the mystery behind these node packages for these type of services.

As you can see below this node package just wrap calls to the paygate API endpoints

So you should be able to do it just with API calls from SC. Maybe contact them so they let you know the complete flow so you can replicate.

2 Likes

Thank you for finding that online. I will also contact then.

1 Like

@Teodor… sorry just to stick to first question just so I know in future. If I want to run an npm as above same type “category” so to speak…(i know its a broad question as there are 1000s of npm’s). then we need to create custom extensions?

But i can run a normal JavaScript directly on the “views” or “layout” pages. … so to “say google analytics” by just adding the script directly to the page…

Thank you

Yes you can