I want to make a web app for viewing, creating, and modifying entries saved to a local file. I will use it on my old budget Android phone, and I want it to be as performant as I can possibly make it.
What do I use to build it?
I want to make a web app for viewing, creating, and modifying entries saved to a local file. I will use it on my old budget Android phone, and I want it to be as performant as I can possibly make it.
What do I use to build it?
@cvennevik Take a look at Kitten (https://codeberg.org/kitten/app) and let me know if it works for you or not :)
@cvennevik Cool. And while you can use the file system directly, of course, Kitten does come with a built-in database that you can use via pure JavaScript.
e.g,
kitten.db.entires = [
{ name: 'Aral’, site: 'aralbalkan.com' },
{ name: 'Laura', site: 'laurakalbag.com' }
]
kitten.db.entries[0].site = 'ar.al'
That’s valid Kitten code that *persists* an array of entries and then updates one (again, automatically persisting the change to an append-only JavaScript log).
@aral I was wondering about pinging you and asking 😊 I might just try it out!
Maybe what I'll have to end up doing is building the app in several different frameworks and comparing them!
(That sounds like the kind of ambitious thing that I'd love to do and, of course, never get around to)
@cvennevik (Behind the magic is the built-in JSDB database exposed via the kitten.db global: https://codeberg.org/small-tech/jsdb)
@cvennevik Makes sense. You could always use the internal database to make updates easy and then store a JSON serialised copy into a file for portability.
(Much easier than persisting JSON updates manually.)
e.g., see https://codeberg.org/aral/gists/src/branch/main/kitten-export-json.md
@aral I'm planning on storing the data in a plain JSON file, so I can easily sync it between devices and potentially create new (non-JavaScript?) apps to work with it!
@cvennevik In fact, come to think of it, you don’t even have to save the JSON file. You can just have a route that runs the JSON.stringify and returns the JSON.
@cvennevik …And, in case you do decide to go this route, to make it easier for you, I just added `.json()` and `.jsonFile()` response helpers to the response objects passed to Kitten routes :)
Example: https://codeberg.org/aral/gists/src/branch/main/kitten-return-json.md
(If you already have Kitten installed, please update it using `kitten update` to get the new methods.)
Best of luck with your project no matter what you end up using :)
:kitten: 💕
#Kitten #SmallWeb #json #jsonFile #response #helpers #JavaScript #web #dev
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.