Within the build of a web application based on Golang, I try to find a balance between how to expose my files and folders. The project should contain tree directories: app, backend, api. app is the directory that hosts all frontend staff. May I create a single for the whole project, may I separate them. I think that you full stack developer you could help me and share with me a complete tree to most of web applications.
评论:
shovelpost:
RevMen:Lately I've been separating my Single Page web apps into two repositories. One that has pure Go API code and the other that has pure HTML/JavaScript/CSS frontend code. It has been working well for me.
kiwibokbok:This is what I do, too. I think there are good reasons to keep them separate.
The front and the back really are separate applications that communicate. It's possible to write/test/deploy them from completely separate machines/environments.
It's possible to write different front ends that communicate with the same back end. Putting all of those different front ends into the same repo would be messy.
The front and back ends can be deployed to different machines.
jackmcmorrow:I like this approach, we have been using it with some non-golang backed projects and it's allowing great separation and testing.
adamkw94:I think your dir structure is ok, but I'm that guy that has backend and frontend in the same folder (which I probably shouldn't do, especially for security purposes
Maybe do app, model (API), controller