Create files from client side JS code

 

You can clone the final project to look at the source and play around with it:

write-fs-from-the-client-js.boomla.net

 

This intro shows how to write the Filesystem from JavaScript code that runs in the browser.

It has two parts:

  • There is an API endpoint at /api/create-file (that we write ourselves), and

  • a client side JS code that is calling the API endpoint, which is at /paper-with-1-column-3/code/script.js

We are using jQuery for selecting the DOM elements and sending AJAX POST requests to the server.

The files that are created are stored under /entries.

 

If you are not an experienced programmer, you might want to consider using a simple form instead and creating the files on the server side similar to the TODO list app example.