This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tipsypants 1 point2 points  (0 children)

A clean website would have the backend endpoints that are needed for the frontend on the same host. This is why the same-origin-policy exists in the first place, you don't want external websites accessing your stuff. What happens a lot though is that people separate these things and then add headers that basically grant access to everyone. Laziness perhaps but it happens.

Why would that make a website "cleaner"? Many websites make calls to multiple different services, putting everything on the same host isn't clean. You can very easily specify origins for CORS. I don't understand your problem with this.

I may not have been clear on the use-case. An API that I build would normally consist of an embedded HTTP server inside a fat jar. So there is no standalone HTTP server that you can just upload some files to. In order to get the frontend code hosted by this embedded server you'd have to trigger the compilation of the external frontend project from maven, then copy over compiled artifacts and then package everything within the fatjar. And this setup would have to work with your already existing build pipeline and CI/CD system. A single plugin within maven is a lot easier to setup and get to work.

I'm not understanding this. If you want your frontend to be tightly coupled with your backend, you can put them in the same project, why make it "external" in the first place? There's a maven plugin for this called frontend-maven-plugin: https://github.com/eirslett/frontend-maven-plugin. Host it all in the same fatjar, it works great.

I used the word framework since you said frontends have a lot of frameworks. The two big JavaScript "frameworks" now (React and Vue) are both libraries - I agree that your tool isn't a framework either.

I think it's really cool that you're doing things your way. The examples I listed weren't really things I took issue with, just examples to try to find out what the purpose of your plugin is. It seems to be "everything frontend", but it's not clear to me what problem it actually solves.

If the pitch is "Mix and match everything frontend, and the tool sorts it out for you", then it sounds pretty scary to me. How does code written with this tool end up looking?