Newb question: Go for back end, how to combine with JS/React/etc

polaris · · 676 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>So this is a pretty big newb question but I&#39;m kinda struggling to find examples and resources of how to link the whole back end and front end together.</p> <p>I&#39;ve found a lot of stuff on simple APIs which makes sense but I&#39;d like to know more about securing them (so people cant just capture the API paths and spam it or whatever) as well as other methods for having the front and back end communicate properly</p> <p>Hopefully I&#39;m not missing an obvious resource but I&#39;ve been looking for a short while now</p> <hr/>**评论:**<br/><br/>inside_looking_out: <pre><p>Just setup some form of REST API and have the JS interact with that. There should be some standard way the JS expects the API to be I imagine and you just build it to those specs.</p></pre>comrade-jim: <pre><p>Yeah this is what I would do. </p></pre>pvsukale1: <pre><p><a href="https://github.com/mattermost/platform" rel="nofollow">https://github.com/mattermost/platform</a> It uses Go in the backend and React as its frontend framework. It is an open source alternative to slack.</p></pre>cypriss9: <pre><p>We just did this in the past week or so for <a href="https://github.com/gocraft/work" rel="nofollow">https://github.com/gocraft/work</a> -- The &#34;webui&#34; package exposes a JSON API, which is consumed by a React app. The React app is embedded in the binary with go-bindata.</p> <p>This is the commit that does it -- <a href="https://github.com/gocraft/work/commit/a2c1415609571df1b5d8a7e0e97578c05f48db99" rel="nofollow">https://github.com/gocraft/work/commit/a2c1415609571df1b5d8a7e0e97578c05f48db99</a> -- you can find some notes in DEVELOPING.md as well about how to do the asset stuff.</p></pre>beeker1121: <pre><p><a href="https://github.com/beeker1121/resounden" rel="nofollow">https://github.com/beeker1121/resounden</a> is my first project coded in Golang and React. There&#39;s really only one place where the frontend communicates with the backend, when someone searches for a Soundcloud user.</p> <p>You can find the React code in <code>public/js/resounden.jsx</code></p> <p>Edit: There&#39;s frontend/backend communication also for getting more tracks as the user scrolls down the page.</p></pre>masterwujiang: <pre><p>API gateway, references:</p> <ul> <li><a href="http://microservices.io/patterns/apigateway.html" rel="nofollow">http://microservices.io/patterns/apigateway.html</a></li> <li><a href="https://www.nginx.com/blog/building-microservices-using-an-api-gateway/" rel="nofollow">https://www.nginx.com/blog/building-microservices-using-an-api-gateway/</a></li> </ul></pre>SupersonicSpitfire: <pre><p>If you don&#39;t mind using Amber or Pongo2 (or HTML) combined with Lua for server-side logic, Algernon has built-in support for JSX and caching. It&#39;s written in Go: <a href="https://github.com/xyproto/algernon/tree/master/samples/react/tutorial1" rel="nofollow">https://github.com/xyproto/algernon/tree/master/samples/react/tutorial1</a></p> <p>With Lua it&#39;s easier to quickly test changes to the business logic. You can call Python or Go if needed.</p></pre>Iggymacd: <pre><p>Have a look at Goa to design your app back end and have goa generate idiomatic Golang backend API that is Restful. Combine that with a frontend like Angular2 (batteries included approach and easier than angular1) or something more lightweight like react.</p></pre>jmank88: <pre><p><a href="https://github.com/gopherjs/gopherjs" rel="nofollow">gopherjs</a> is pretty great. </p></pre>interactiv_: <pre><p>lol no.</p></pre>shovelpost: <pre><p>What&#39;s wrong with gopherjs?</p></pre>hukiki: <pre><p>Nothing. But this was not the answer to the question. OP wanted to know how to get go to take care of the backend things while js/react took care of the front end. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

676 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传