Single Page Applications using Picos

Picos can be used as a powerful and expressive “back end” for a single page application running on the web.

Using Picos as the server-side for a Single Page Application” is an experience report showing complete source code, both “front” and “back,” as an example of this idea in action.

1 Like

After discussion with Phil Windley, I re-wrote the ruleset using a map instead of an array. This makes the rule for recording time_in much simpler and efficient. Nothing has to change in the front end because the entries query simply returns the values() of the map.

Note also the use of a rule to initialize ent:entries to an empty map. This rule is selected with either of the other rules, and KRL semantics guarantee that it will be evaluated first because it appears first lexically in the ruleset.

The ruleset can be directly installed into a pico using this github URL and the source code for the front end is in the same repository

1 Like