Creating an html page client side

I am wanting to know if it would be possible to have an app or a website create an html file on click (javascipt or AJAX possibly) and then send that page to the network at a designated (public or private) location.

This would be similar to a CMS creating a new page for blogs, etc.

The only references I can currently find are all server based php instructions and I am not sure how this could be done with the API…

Any thoughts/feedback would be appreciated!

Thanks!

I think that can be achieved by creating the HTML file on the client side (JS), then store it using the NFS API, followed by creating a long name and service using the DNS API. All these steps can be performed by the client JS, then it just shows the user the service and public id where the page can be found, or just redirect to it. Is that what you’re looking for?

2 Likes

Yes, that helps. Are there any example apps that would show how to use the NFS and DNS APIs?

I can remember of a couple:

I also posted a Postman collection which I use to understand the APIs before coding the calls in any language: https://github.com/bochaco/safe-launcher-api-client

I’m sure other people can share more examples.

3 Likes

Not sure, everything’s always changing

This is almost exactly what the Demo App does, using the REST API (which is available as safe-js in beaker). Not the easiest code to inspect, but it is all there - you would be storing the files you generate directly in the network rather than loading them first from disk and saving them to the network, so less work in fact.

Still interested in making a website builder? :slight_smile:

I think you are light years ahead of me with SAFEpress on that one…lol. I just want to learn for my own satisfaction at this point. If I get to a place where I could maybe add value to the project I will definitely let you know! :wink:

2 Likes

Well, I’m not very far along, and it’s a very slow process on my own so I’ve dropped down a few gears to focus on just heading in the general direction and seeing if I can produce something useful (whatever it might be) to help the project, and have some fun (I love learning and building).

Maybe we can find something to work on together or just help with what each of us is working on. So let me know if I can help or if you want to discuss idea etc.

I’m still working on adding support for SAFEnetwork to remotestorage.js at the moment (so client side backend). Meanwhile I’m rubbish at website design (despite having created a website editor decades ago) so maybe there a synergy for us there?

1 Like