re-enable backend functionalities #40

Open
opened 2 years ago by utopiah · 6 comments
Owner

Including in particular poly.pizza caching and processing through containers.

Could rely on testing via fetch() if a backend is available then clarify why related capabilities (functions and interface) are unavailable.

Including in particular poly.pizza caching and processing through containers. Could rely on testing via `fetch()` if a backend is available then clarify why related capabilities (functions and interface) are unavailable.
Poster
Owner

Consider also new functionalities e.g

  • save change on top with optionally reload (as before with sseSend(data))
  • as this is risky (can end up in a broken state) be able to restore from past working state

So overall might have to consider saving changes in a repository, e.g git managed by the server. See https://twitter.com/utopiah/status/1642788355648675842 providing Gitea on device.

Consider also new functionalities e.g * save change on top with optionally reload (as before with `sseSend(data)`) * as this is risky (can end up in a broken state) be able to restore from past working state So overall might have to consider saving changes in a repository, e.g git managed by the server. See https://twitter.com/utopiah/status/1642788355648675842 providing Gitea on device.
Poster
Owner
See https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/index.js
Poster
Owner

Basic example on device (using Termux) to save locally as new.html file

const fs = require('fs');
const express = require('express')
const path = require('path')

const app = express()

app.get('/', function(req, res){
        res.redirect("engine/index.html")
});

app.use('/', express.static(path.join(__dirname, '.')))

const port = 7777
app.listen(port, () =>
  console.log('listening on port', port)
);

app.use(express.json({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb', extended: true, parameterLimit: 50000}));

// queried as fetch("/",{ method: "POST",  headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },body: JSON.stringify({number:42})})
app.post("/", (req, res) => {
    res.send(req.body)
    fs.writeFileSync('engine/new.html', String(req.body.number) )
})

Itself can be queried as


fetch("/engine/index.html")
.then( r => r.text() )
.then( t =>  fetch("/",{ method: "POST",  headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },body: JSON.stringify({number:
    t.replaceAll("jxr", "OK")})}) )

which for examples replace all instances of jxr by OK (and surprisingly doesn't seem to break the code).

Basic example on device (using Termux) to save locally as `new.html` file ```javascript const fs = require('fs'); const express = require('express') const path = require('path') const app = express() app.get('/', function(req, res){ res.redirect("engine/index.html") }); app.use('/', express.static(path.join(__dirname, '.'))) const port = 7777 app.listen(port, () => console.log('listening on port', port) ); app.use(express.json({limit: '50mb'})); app.use(express.urlencoded({limit: '50mb', extended: true, parameterLimit: 50000})); // queried as fetch("/",{ method: "POST", headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },body: JSON.stringify({number:42})}) app.post("/", (req, res) => { res.send(req.body) fs.writeFileSync('engine/new.html', String(req.body.number) ) }) ``` Itself can be queried as ```javascript fetch("/engine/index.html") .then( r => r.text() ) .then( t => fetch("/",{ method: "POST", headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },body: JSON.stringify({number: t.replaceAll("jxr", "OK")})}) ) ``` which for examples replace all instances of `jxr` by `OK` (and surprisingly doesn't seem to break the code).
Poster
Owner

See https://factsheet-permanence.glitch.me as remixable Express based examples saving (parsimoniously) and loading all entities with a target component.

See https://factsheet-permanence.glitch.me as remixable Express based examples saving (parsimoniously) and loading all entities with a `target` component.
Poster
Owner

See instead https://glitch.com/edit/#!/jxr-permanence with generic content

See instead https://glitch.com/edit/#!/jxr-permanence with generic content
Poster
Owner

As container with usual setup, i.e Lets Encrypt subdomain and nginx reverse proxy :

As container with usual setup, i.e Lets Encrypt subdomain and nginx reverse proxy : * XR https://jxr-permanence.benetou.fr * JSON DB https://jxr-permanence.benetou.fr/saves * 2D https://jxr-permanence.benetou.fr/flat
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: utopiah/text-code-xr-engine#40
Loading…
There is no content yet.