I set up a relay server to log all messages between
the Tiddly wiki and the node backend. This is what happened
(Messages always start from the TW - these are the HTTP messages involved)
1) "OPTIONS /"
response 404 Not found
(I had to look up what OPTIONS means - it expects a response something
like Allow: OPTIONS, HEAD, GET, POST)
2) Server closes socket
3) "GET /"
Reply is 200 OK with chunked transfer encoding and a keep alive connection
then we get about 6MBytes of text/html
(I have a question about this response at the end of this mail)
4) "GET /status"
Response is a JSON term
{space:{recipe:default},tiddlywiki_version:"5.1.15"}
5) Server closes socket
6) "HEAD /"
response 404 Not found
7) GET /recipes/default/tiddlers.json
Now we get a JSON term with a long list of tidders back
8) PUT /recipes/default/tiddlers/%24%3A%2FStoryList
Data is a JSON story list
Response 204 OK
9) Server closes socket
The I did some things in the browser
10) PUT /recipes/default/tiddlers/%24%3A%2FStoryList
Data is a JSON story list
Response 204 OK
11) Server closes socket
I did a write in the browser
12) PUT /recipes/default/tiddlers/Draft%20of%20'ProofOfWork
Data JSON
Other messages include
DELETE /bags/default/tiddlers/Draft%20of%20'ProofOfWork'
PUT /recipes/default/tiddlers/ProofOfWork
data JSON
Enough tracing ...
Comments (and questions)
To make a back-end I need to convert the JSON form of the GETs and PUTs into
a suitable file format.
The tidder ProofOfWork in a file looks like this:
---
created: 20180219090531165
modified: 20180219090536326
tags: Silly
title: ProofOfWork
type: text/vnd.tiddlywiki
Energy efficiency is appalling oh
This is slightly different from the JSON term that created the file
The term was
{created: "20180219090531165",
text: "Energy efficiency is appalling oh",
bag: "default",
revision: "0",
type: "text/vnd.tiddlywiki",
title: "ProofOfWork",
tags: ["Silly"],
modified: "20180219090535217"}
So the backend has thrown away the bag and revision tags.
The only biggish problem in making a backend is the response to the first
message (the one that results in 6MB of stuff)
Somehow the backend has created a huge page from the data in the file
system.
Is the relationship between the data in the file system and HTML that gets
sent to the browser simple? - ie just the concatenation of a bundle of files
or has the backend done some heavy lifting to make the HTML page?
Cheers
/Joe