SCE is a Next.js project where the admin can edit the content of the pages directly in the browser using Editor.js
This project uses Static Generation so the HTML is generated at build time and will be reused on each request. Also, it will be regenerated with each change of the content.
In addition, it uses Server-side Rendering for the edit pages so the HTML is generated on each request as an admin.
First, you need to create some files not included in this repository.
-
In the root folder, create '.env.local' with the entries:
DB_USER=admin_user
DB_PASS=admin_password
IRON_SECRET=32_characters_long_private_key_to_encrypt_cookies
-
Now in the 'data' folder, add a .json file for each of the editable pages included (atm it will be about.json and index.json) The content of these files should be in a readable format by editor.js, this is an example you can use to bootstrap your application:
{ "time": 1637196257931, "blocks": [ { "id": "KOigsjrDCs", "type": "header", "data": { "text": "Welcome", "level": 2 } } ], "version": "2.22.2" }
Then install all dependencies:
npm install
Now you can run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.