CommonJS and ES6 with NodeJS

Happy New Year @maher.aldous

OLS/LiteSpeed Web Server acts as a frontend proxy to the Node.js backend via a unix domain socket without the need for separate web application server like Phusion.

Now with that said the key here is to proxy all our nodejs traffic using lsws

This is a good start however to deploy our “api” project I recommend a process manager like PM2.

$ npm install pm2 -g
# add app to pm2
$ pm2 start dist/app.js --name "es6-setup-node" --watch
# daemonize your app
$ pm2 startup && pm2 save
# to see all your node apps
$ pm2 list
# Display all apps logs in realtime
$ pm2 monit

Then proxy your app traffic by setting up an appserver context Setup Express.js Application on CyberPanel/OpenLiteSpeed

This assumes you have a domain so visit you app api.mydomain.com