Forum

How to run a web server in WEB OS?


#1

Hi all,

I am creating a webapp package with node.js express.

I tried to create new package for JS service and copied express package in node_modules. But I am not sure how launch the service in WebOS package.

I have an experience to launch express web server via nodemon in Windows environment only. Can you please give an advice launch the service in WebOS ?


#2

Please see http://webosose.org/develop/sdk-tools/cli/command-usage/


#3

so, normally, Javascript services are built to be run by activitymanager, when they are needed. For something like an always-on service, like that, though, you probably want to have a file in /etc/init that starts your service at system bootup... OR you can create an activity in activityManager that calls your node service at start, which would be a bit more of the "webOS way" of doing it, though either one should work equally well.

This is assuming that you are using webOS OSE, so you can build your system using bitbake.. if you install a file that looks a little something like this into /etc/init:

description "starts my web service"

start on (settingsservice-ready) or unified_service_server_restart
stop on started start_update

respawn

script
    exec run-js-service -u -g -k -w -n /usr/palm/srevices/(yourservicedirectory)
end script

then that should get you launched at startup.

I'd have to look up the specifics for doing it via activitymanager, which is the way i would do it if I didn't want to modify the startup files


#4

note that that file may be entirely different for a system using systemd, which I believe OSE does. Please look at files in /etc/init for guide on that. My template may be completely wrong, I'm not working with OSE, but I do work with TVs, and older :slight_smile: