V
V
Vadim Somov2018-03-19 16:39:34
Frontend
Vadim Somov, 2018-03-19 16:39:34

How is jsFiddle implemented?

How are some things implemented in jsFiddle?
1) What generally happens when you click the save button?
2) How is the link of your project generated
And is it possible to do this with a minimum of backend? and without databases. Isn't it necessary that all this is stored on the server, and all the json content is delivered to the user via a link and stored locally? And how can this be implemented in general terms?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Vekov, 2018-03-19
@vekov

1)
- Validation of each field
- A page is generated, where the code from the fields that you filled out (JS -> <script></script>, CSS -> <style></style>and HTML -> <body></body>) is written into separate tags
- It is inserted into the iframe from the bottom right.
2) The link can be generated as a record ID in the database, for example.
You can, of course, use files instead of databases, but do you need it?

S
Stalker_RED, 2018-03-19
@Stalker_RED

1. the code is saved on the server and a link is generated
2. a random piece of text in base64, probably.
Without a database, you can (store in files, for example), but it's even more difficult.
You can store locally, but what's the point? You can't give a link to this.

I
ice2038, 2018-03-19
@ice2038

1) All entered code is stored on the server
2) The link is generated by a typical uuid library https://www.npmjs.com/package/uid
Can be stored in the user's browser using IndexedDB https://developer.mozilla.org/ru/docs/ IndexedDB/Us... .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question