 Hi everybody, welcome back another technical demo around the serverless function. My name is Daniel Oh. I'm working for Red Hat as a technical marketing major. In this video, I'm going to showcase how to create the function project based on Node.js framework. And we're going to use open to the serverless container platform based on function serverless capability. Let's get started. So based on open to the serverless operator, the race version 111, which is based on open to the 4.6 cluster, you can have a powerful CRI command line experience based on local application development for specifically your function application. And you can deploy and build that application based on build path. And we're going to use the KNA with service command line also known as KNCRI. And we have a multiple project template Quarkus Node.js Go. And we can trigger that function based on cloud event and HTTP protocol. We're going to talk a little bit about demonstrate Node.js for this demo. Let's get into demo. So here is our sample application project Node.js.js. As you can see, there's no resource at this moment, no path, no resource at this moment. All right. So let's create the function project for Node.js application. We're going to use a KNA command line. KNFunk create the Node.js-funk. This is the function name. And then as a default, the runtime is Node.js. So the Node.js function project automatically generated. And then let's open ID to to take a look at the more detail how to implement this project. So function name Node.js-funk and the namespace and image image digest are not defined at this moment. Or we're going to specify in the next command line. Don't worry about that. And we're going to use the okay. So let's take a look at that the sample application JavaScript here. So how to handle invoke your get or pause the method from end user or the RESTful API. All right. Pretty simple. And next step, we're going to deploy this application. Actually, the deploy command line include the build capability as well. So let's try to run KNFunk deploy. And we're going to specify external container registry when you build this application. And then we need to push this container or image. So query.io one of the options you can actually use that can help as well. And then we're going to specify namespace like a Node.js-funk we saw earlier. And then as you can see, we're going to use Node.js a better image and runtime image. Once you build the Node.js application, we're going to push that containerize image into the query.io. In the meantime, I will defunct YAML file already update automatically along with the already the build output. So when you go to a load file on our container platform, this application is already running based on KNF service and capability. So here is an endpoint to access this function through the router. So let's try to access the endpoint using call command or the HTTP Pi utility. So I'm going to pass down one parameter based on JSON format. So name is Daniel O and I'm going to trigger the endpoint using HTTP protocol. I got the recent message. Pretty cool. So this part will be scaled down to zero automatically in next 32nd, which is a default compilation. So we're going to add a new label in this application like a Node.js. So you can see the pre-also Node.js icon in the path because we're going to create a new project for handling cloud event, not HTTP protocol. So let's give some a little bit more time to scale down to zero this application. In the meantime, let's take a look at what kinds of command lines that we can use to create and build, deploy the Node.js application based on KNM func. So you can actually specify a specific runtime Node.js, Quarkus, or Go. And also you can trigger your function, HTTP request, but also you can use cloud event. And then you can also build this function separately with the deployment. And in order to build your function, you can specify image name or external registry, etc. As you can see, we already used KNM func deployment features to deploy this application. Okay, now the Node.js part will be scaled down to zero completely. And then let's try to trigger this application one more time to make sure these applications get up automatically, just like serverless capability, with a different perimeter, like an open shift, serverless, and function with Node.js. So luckily, the redhead runtime subscription support Node.js as cloud and runtime environment as well. Okay, so automatically and magically your Node.js application is speed up just like a serverless behavior pretty fast. In the next step, we're going to create a new project, but we're going to use cloud event trigger rather than HTTP. It's more available to cloud application based on event-driven architecture. So we're going to pass down dash t parameter with the event, and then we can find a new project here. And let's open up func.eml file and a new function named the Node.js-func-event, and then we're going to use trigger event. And then when you open index JavaScript, you can find the cloud event implementation. It's already generated during the creating project. It's very simple. And it changes directory to write project Node.js-func and event, and let's try to deploy this application into external registry. I'm going to use again my quay.io my credential in the namespace. We're going to use the same namespace in which the container platform. As you can see, we're going to use Node.js build.img just like the previous one in the runtime.img. And then we're going to use a build path to build this application. And once we've done the build application, we actually push new containerized image into quay.io on my credential. And then we are in this application ready to deploy on a container platform as KNAV service. So, and when you take a look at that funk.io mobile, the all images 3 are already updated based on our the KNAV deployment output. So, this Node.js part is running very well. And in the meantime, it's already scaled down to zero, just like a sub-recipe behavior. Let's try to add a new cloud source event to trigger this application, just the select pin source and then we're going to data message it like a Node.js function events in a schedule every single one minute or this pin source trigger our Node.js fun event part automatically and repeatedly. Let's create this one and just give us some more time to call our the part of the application. Okay, so Node.js is just running up and you click on the view log and then take a look at that logs. And then what you can find here, the cloud event received from the pin source and then the message Node.js function event. So, this is a really simple way how to create your Node.js application for sub-less and function based on upper sub-less capability. So, you can find the two functions already we deployed in our official container platform. If you don't need to maintain any specific function any longer, you just delete it. And then we just delete the pin source as well. And it will be deleted in a few seconds. As you can see, it's already deleting all resources like service and revision or opposite to all resources related to sub-less. So, make sure to retrieve the function list and then you can find there's only one function. All right. Thank you for watching. If you have any question around Node.js for cloud neighbor runtime or upper sub-less function capability, please let us know. We are more than happy to address your question. Have a good rest of the day.