TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pattern: Back ends for front ends

53 pointsby r4umover 9 years ago

6 comments

jtmarmonover 9 years ago
This is how netflix approached api gateways. <a href="http:&#x2F;&#x2F;techblog.netflix.com&#x2F;2012&#x2F;07&#x2F;embracing-differences-inside-netflix.html" rel="nofollow">http:&#x2F;&#x2F;techblog.netflix.com&#x2F;2012&#x2F;07&#x2F;embracing-differences-in...</a><p>However, this approach is a giant pain in the ass and technologies like Falcor (netflix cannabilizing its own pattern) and (my preference) GraphQL will come to replace.<p>With a generic client side query language, you don&#x27;t need to deal with versioning APIs, lots of concurrent development, overhead of deploying a new API for each client, the list goes on. GraphQL in front of a set of services is how we&#x27;re approaching our next project and it&#x27;s working really well so far.
评论 #10663123 未加载
评论 #10661899 未加载
virmundiover 9 years ago
Or for those wanting to use an already defined pattern: API gateway pattern [1]. Same idea, already identified.<p><a href="http:&#x2F;&#x2F;microservices.io&#x2F;patterns&#x2F;apigateway.html" rel="nofollow">http:&#x2F;&#x2F;microservices.io&#x2F;patterns&#x2F;apigateway.html</a>
评论 #10661188 未加载
avitzurelover 9 years ago
Right now I am working on a talk around this area and an idea came to my mind that I think is worth a discussion here on HN.<p>In today&#x27;s front-end technologies with webpack and webcomponents why wouldn&#x27;t you compose application that call different services and compose the UI based on these services.<p>For example, you have a login&#x2F;welcome component that will call the auth service and will check if the user is logged in or not and show the appropriate message or login screen. If the Auth service is down you can simply show a message.<p>This way, each component is aware of the service it has to use and you can package it into the application deployment process.<p>It&#x27;s worth a thought that if you already have micro-services you should also break your application apart and not have a monolithic front-end.<p>I am not an Android&#x2F;iOS guy so I&#x27;m not sure if this is even viable there but these days, I&#x27;m pretty sure we&#x27;ll start seeing front-ends that are composed around small single-responsibility services.<p>One of the biggest advantages of that is that components and services are independent, you can split the work between teams and the application deployment will join everything together.
评论 #10661988 未加载
zarothover 9 years ago
AKA the BLL or Business Logic Layer? I guess the only reason you would re-write business logic in the presentation layer is because you can&#x27;t afford the extra round-trips, and it&#x27;s cheaper than writing an aggregation layer on your backend.<p>But generally wouldn&#x27;t you just add the APIs into the core microservice to return the requested dataset (at the various necessary &quot;levels&quot; of cardinality) for the various different consumers? Keeps everything in one place.<p>Then you use nginx lua script to allow a single HTTP request from the client to be dispatched to the various microservices and packaged together in the reply in a singel round-trip. This can be just a few lines of code serving any combination of possible sub-requests. I don&#x27;t like the idea at all of building another service layer on the backend to do the aggregation and expose a different API... I think you can do something similar in the development branch of HAProxy.
scotty79over 9 years ago
Just remember that each arrow that crosses team boundaries on those graphs costs a lot. Usually the cost is on the side of the team on receiving end.
olalondeover 9 years ago
It seems GraphQL would be an alternative solution.