What is Node.js and why would I use it?

How have you managed to keep this under wraps until now? Seeing all the mention of NodeJS for months while developing the integration of it and not letting on! It must be a relief now it’s common knowledge.

1 Like

With Wappler we like to surprise :slight_smile:

2 Likes

So currently Wappler supports server action scheduling (as cron jobs) for php and asp, but not yet for node.js. Is that correct?

Well you can run the server actions as any other php file, using cronjobs.

1 Like

In the new NodeJS integration - NodeJS is also your webserver so you have full control.
We will be integrating full scheduler in it, so you will be able to schedule Server Connect actions to run automatically. Just as you do now with cron jobs - but with NodeJS it will be all done within Wappler - so much more easier and flexible.

11 Likes

So what is involved in doing that?

  1. Change Target Server Model from PHP to NodeJS.
  2. Then what? :thinking:
    So you go into each Server Action?
    What do you do?
    Do you have to write each one from scratch again?

I am copying the json that forms the SC action and then adjusting. It’s in that adjustment that a second instance would be handy.

Isn’t the serverconnect framework agnostic of the server model? Shouldn’t all server action files works just fine when changing the server model. Shouldn’t the extra effort be just around setting up the “server”?

Easy to say, but practically might be hard. I just wanted to understand how much of effort is it to make the “switch”. Of course, I’m not going to change my server model on the daily basis…

1 Like

¡No entiendo!

It is. The framework.
But the files that have the SC action data(json) are dependent on server model.

So for PHP model the json is enclosed in .php files and have some overhead. For node they are pure json with no overhead.

Thanks for providing clarity on that @JonL… never bothered to look under the hood…

George’s converter makes sense now, and becomes essential now!

1 Like

I’ve created a brand new NodeJS project to give it a quick blast. Setting up was pretty painless - downloaded and installed NodeJS, then Docker, then created my index.htm page and browsed to it at http://localhost:3000. All good.

But… I can’t see where 3000 was set and what would happen if I create another new project. Docker says there are no containers running so I’m guessing Wappler has done something directly with Docker?

Finally, does Docker support MySQL or MariaDB? Just getting the basics in place and then I can start switching to NodeJS for future projects.

@sitestreet You may want to look at a container manager if you think you will be running multiple docker containers in the same instance. Portainer is a good shout. MySQL/MySQL server and MariaDB can be run inside a docker container.

Either that or if you want to avoid Docker you can deploy through GIT to a PaaS. Heroku is well known or I prefer using Now.sh where I can.

1 Like

You can’t just change now - it will break everything. We need to write a converter first and even then you will have to do a very controlled conversion performed after you have backup your project .
As many things will be different

2 Likes

/lib/setup/config.js

We will be adding and document more config options to our NodeJS implementation soon, so you can control everything

2 Likes

lol @ the Deno joke! It makes it even better with PHP in the background*

3 Likes

Better to wait for the final release. What I am doing is not user friendly.

So if I am understand this correctly a use case of node.js would be to have a site for example an auction website where an a bidder a bids on an item and another bidder b would see that bid show up right away with having to do a page refresh or you could take that a step farther if bidder b was the winning bidder prior to the bidder a bidding, once bidder a bid bidder b would not only see the new price but now might see a flash of a red background for that item.

Is that correct, basically all time stuff that happens without a page refresh. Can you do that today with php in Wappler?

Would there be any advantage to learning Node.js so that we can be aware of all the tricks-of-the-trade within Wappler both now and the future?