📜 ⬆️ ⬇️

Dynamic serverless sites on Github Pages (for those who don't know, serverless use third-party API servers)



Surely many have heard about github pages and that static sites can be placed there (generated and uploaded there). But I would like it to have a dynamic, that is, it would be possible to fill in the code once and fill it up as if it were a real TsMSka, and even authorization was, dynamically loaded data and all that. Right? So I wanted this. Come under the cat, show that I did.

For a start, as I promised, I will show what happened, and then I will tell the details (watch for the change of tabs and page addresses).


So what happens here? Recently, I wrote about what I'm writing headless-cms, codenamed Prisma CMS .
')
But as I wrote, initially the idea was such that although the server and the front are friends with each other, they should still be able to live their own lives and are independent units. And if the server follows the modern trend of headless-cms / api-first-cms, then the front follows a different concept - serverless. That is, if we launch a separate front, we simply point out the endpoint of the API server (not necessarily on the same domain), and the data will be pulled up via the API (and the authorization will work).

But that's not all. At the offsite, I wrote an article about the fact that at prisma-cms.com everyone can create a website on a subdomain that will use a single database, but you can individually create your own website. So, if you copy your prisma-cms.imtqy.com repository, you will get your own website, as shown in the video.

But you can even raise your own server and website. Here are the source of the site: https://github.com/prisma-cms/prisma-cms.com . Deploy on your server and run. If everything works, here you specify your endpoint API and build it with the command PUBLIC_URL =. / Yarn build
Everything, the site is ready. Now, following the official instructions, fill in the contents of the build folder on the githab and you have your own website with your API (you can use one API for working heaps of separate static sites, each of which can be with its own separate design).

And I knowingly used a picture with an inscription Social coding. As can be seen in the video, all templates created on any of the sites that use a single database can be used in the design of other sites. That is, in the future, if the interest is sufficient, it will be possible to create a single marketplace of templates and parts of templates for quickly creating websites from ready-made components.

All nice coding!

Source: https://habr.com/ru/post/458006/


All Articles