Replies: 0 comments 6 replies
-
I think we should focus first on our built-in client and make the possibility of using an outside client for the end of the beta. @Nesqwik can you document your PoC here (or if it's already done add a link to it) ? |
Beta Was this translation helpful? Give feedback.
-
Lenra View systemRequirements :In order to work, this View system require some other feature to be implemented first.
The Goal :Open the view system to allow devs to use external UI library. The view system will keep the ws listeners call secure. The dev will provide multiple Routes. Each entrypoints will specify a Widget name, an Input query, a props, a View type and a route path. The manifestLet’s take the Counter app as example. module.exports = () => {
return {
routes: {
"/counters": {
name: "countersJson",
query: {
"$find": {
"_datastore": "Counter"
}
},
view: 'json'
},
"/counters/:id": {
name: "counterJson",
query: {
"$find": {
"_datastore": "Counter",
"_id": "@id"
}
},
view: 'json'
},
"/lenra": {
name: "main",
view: "lenra"
},
},
}
} Here, the dev can define any number of routes that point a widget :
The widgetsThe The new module.exports = (data, props) => {
const counter = data[0];
if (!counter) return {};
return {
_id: counter._id,
value: counter.value,
increment: {
type: "listener",
action: "increment",
props: { _id: counter._id }
},
decrement: {
type: "listener",
action: "decrement",
props: { _id: counter._id }
},
delete: {
type: "listener",
action: "deleteCounter",
props: { _id: counter._id },
}
}
} This widget will return a Json object containing the counter value and ID. It will also define some // This listener
{
type: "listener",
action: "increment",
props: { _id: counter._id }
}
// Is transformed into this code
{
code: "..."
} The
Additionnal work that can be addedAfter this system is enable, we can add some features to it.
|
Beta Was this translation helpful? Give feedback.
-
Outside client system can be a huge boost to Lenra. This allow any dev to use React/Flutter/Angular or any client that can handle websocket to build an app using Lenra. Lenra then behave like a back-end listener action with realtime data system.
I want to be able to create my own websocket and connect it to the Lenra system.
I want to be able to connect my front-end component to a back-end "view" with "props" to parameter it.
My back-end View will connect to a chunk of data using a Query and format the data as i need to.
I want to be able to run back-end listener from a front-end click.
My listener will update data then my view connected to the back-end data should update realtime.
Beta Was this translation helpful? Give feedback.
All reactions