How do you program moderm web apps? I am reasearc...
# javascript
e
How do you program moderm web apps? I am reasearching https://github.com/JetBrains/kotlinconf-app and I am scratching my head right now. There are 3 components: 1. Backend 2. Android Client 3. IOS Client Backend just responds to REST API requests and nothing more. Android and IOS client have their own Main() functions so they are fully functional applications themselves. How do you supposed to make a web client in this architecture? Is there supposed to be a second server which provides browsers with
index.html
and then javaScript in that index.html makes REST API requests to the original backend? Would you make a separate module for a web client (similar to andoid module) or you just make a
jsMain
sourceSet in the backend directory?
h
The web ui would be yet another client, just like android and ios are. So your frontend will issue REST calls to the backend
Depending on the differences it might make sense to extend the backend (check out backend-for-frontend paradigm)
But for now, as long as the web isn’t doing anything different to the existing clients, should be good to go
e
So backend module provides both REST API and all the web client resources: *.html, *.js, *.css?
h
Yep, that is the idea
e
Thank you!
h
Web is just another frontend application that happens to run in the browser 😉
✔️ 1
No worries. Good luck and keep us posted on your progress
e
I was confused, because I thought there in a large project should be different teams which develop frontend and backend
h
Ah, one more thing, the web assets don’t need to come from the same backend server. In theory you can host them on a S3 bucket (for the sake of argument)
It really depends on what you are building and what your strategy is. But usually frontend and backend should be decoupled and work agains a shared contract / interface that in most cases is REST via http
n
Ahh I see that Egor isn't used to looking at Super Git repos. In a Kotlin MPP repo (if Git is used then it is a Super Git repo - a Git repository that contains two or more projects) each Kotlin module is split into one or more Gradle source sets.