Today I read a fantastic blog post by Aral Balkan, Build a simple chat app with Site.js. You probably know I’m a Perl person and I’d probably use *Mojolicious* to write a chat aps. I used it to write my Gridmapper server (a service that keeps multiple Gridmapper maps in sync and allows you to “join” other maps as they are being drawn).
Build a simple chat app with Site.js
In the blog post, Aral introduces Site.js, shows how to install it, how to serve static content, how to serve dynamic content, and how to use web sockets. And then he uses it all to build a very simple chat app – and if you visit the page you’ll see that it’s live!
What I really liked as I read through the tutorial:
1. It all fits into one blog post!
2. “*Site.js* will work to seamless provision *Let’s Encrypt* certificates for you so you will not get any certificate errors.”
3. The installation instructions don’t talk about *npm* and *node* or frameworks or programming languages.
This is very cool. 👍
The installation basically involves downloading a release (currently 12.7.0.tar.gz), unpacking it, and installing it. It’s a binary that gets moved to `/usr/local/bin`. I guess you just have to trust Aral that he’s not doing anything nefarious to you. Or just run it on a cheap machine where it won’t be able to do any damage. 🙂
By hiding it all in a binary, it’s a lot more opaque, but at the same time it’s also so much easier! If it came with my package manager, I’d install it in a heartbeat.
I should try and install it without `sudo`, for a separate user. The first problem you will run into is that you need priviledges to run a service on the HTTPS port (443):
Error: could not get privileges for Node.js to bind to port 443.
Makes sense. Hm. 🤔
Before that, you’ll also run into this:
/bin/sh: 1: setcap: not found
Also makes sense because it’s for super users: `/sbin/setcap`.
Oh well. I guess a dedicated little machine would be best!
#Web
(Please contact me if you want to remove your comment.)
⁂
@aral sent me à reply on Mastodon and told me of two ways to use it without a binary.
With Node.js installed:
1. Clone repo
2. `./install`
3. Review the source code to ensure I haven’t haxored your system
4. `npm run install-locally`
That’ll compile the binary from source and install it.
Or just run `bin/site.js` instead of the site binary.
– Alex Schroeder 2019-10-12 21:13 UTC