Hello world (JS)
Last updated
Last updated
First let's create a simple hello-world script. We are creating a function called handler() that we act as the entryPoint of our Function. Our goal is to print a simple "hello world" to the console.
If you are using visual studio code, this should look something like this:
You can deploy it to the task service using the EXH CLI Tool.
To create a function we need to provide:
Function name (name
)
Reference to the directory containing the (built) code (code
)
The entryPoint in this case our handler function in the index.js file (entryPoint
)
The runtime needed to run our code (runtime
)
You can see a hello-world function has been created in the task service. See the Tasks page on how to create a task and run it.
When synchronizing your task, make sure that you also include the node_modules
directory if necessary
Make sure not include any developer dependencies when bundling your task. Otherwise the size of your task might be too big (there is a 10MB limit). You can easily strip developer dependencies by using npm install --production
or yarn install --production