How could you recreate server-side logic with IPFS?

IPFS is a very exciting technology, but I fail to see how it could completely replace HTTP.

How could you make REST APIs with IPFS for instance? You’d have to generate a content ID (CID) of something dynamic. Every time a webapp requires a server-side logic like for templating or a centralized database, HTTP is still necessary, unless every peer on the network runs the webserver and has exactly the same database (which would be a very big security breach, let alone the fact that no one would want to host your webserver on their computer).

I agree that if all your website is static HTML pages, images or videos, it could very well be served with IPFS though.

Thank you for your help.

Building web-apps out of only IPFS will requires a new web architecture. This new architecture is usually called “dweb” (decentralized web). In short, the answer is “don’t”. That is, don’t have a centralized database, don’t have REST APIs, etc.

Unfortunately, this is a rather large and complicated topic but I encourage you to look at, e.g., the W3C’s Solid to get a better understanding of how systems like this could work.