In this guide, we will show you how to write a hello world tpk (Tizen Package) using lwnode.
Create a project with the command below.
tizen create native-project -n <app-name> -p <profile> -t ServiceApp
For example,
tizen create native-project -p iot-headless-6.5 -t ServiceApp -n "helloworld"There will be a res folder in your project. It's the place where your code should be.
Create a JavaScript file named index.js in the folder. It will be an entry point for your app.
For example,
// path: res/index.js
console.log('hello world');tizen-manifest.xml, the application manifest, consists of application information, such as
package, privileges, and version which are available for your application. To run your code on lwnode,
you need to write an executable file path as below.
<!-- add `/usr/bin/lwnode` into the `exec` attribute. -->
<service-application appid="org.example.hello" exec="/usr/bin/lwnode" ...>Use the commands below to pack your app as a tpk.
mkdir -p .buildResult
zip ./.buildResult/<app-id>.tpk * -r
tizen package -t tpk -- ./.buildResult/<app-id>.tpkInstall the Tizen package on a target device and run it.
You can find the console log, hello world, using dlogutil <app-id>.
dlogutil <app-id>