<p>I've tried finding examples of this but all I find when googling nodejs and golang together are articles comparing benchmark speeds. I'm trying to setup a basic development environment with two servers. One being a nodejs server that makes requests and gets responses from a golang server. Help me out please</p>
<hr/>**评论:**<br/><br/>itsmontoya: <pre><p>What you're speaking of sounds like a simple API. What are you trying to communicate exactly?</p></pre>_BubbaGump_: <pre><p>I want to design nodejs as the first layer of servers that capable of handling universal javascript and have golang be the api server layer. I'm just trying to design a basic <code>Hello world</code> with this architecture</p></pre>itsmontoya: <pre><p>Sounds convoluted. Why not just write the entire backend in go?</p></pre>PaluMacil: <pre><p>Chances are that a website would craft JSON for the request to the server and then Node would send the same JSON to Go (it's a great format for any language to send or receive data), so I think we're all missing what you want Node in the middle to do.</p>
<p>You mention universal JavaScript, which I assume means you have a specific bit of work you'd like to accomplish in the server, but if you can explain what this needed functionality is, we can probably point to a Go solution so that you won't need to have multiple server apps for a simple application.</p></pre>joncalhoun: <pre><p>It sounds like you want JavaScript making HTTP requests to a go server and getting responses to do something with them. </p>
<p>The problem I'm guessing you are having in is that node.js and golang are both server side things. What you likely want is some client side JavaScript (or really any job at all) making http requests to a golang server. </p>
<p>Even if that isn't what you want, you don't <em>have</em> to do both at once. First you need to learn to use golang to serve request (probably json?). Then you need to independently learn to make http requests to a server with JavaScript. Then you just use js to create a request to a url that maps to your golang server. </p>
<p>If you could shed a little more light on your goals it would be possible to get more specific than that, but with what you have provided j think that's about as detailed as I can get.</p></pre>Swarengen: <pre><p>node.js is the worst fuckin thing that has ever happened to computing. pls stop.</p></pre>shark1337: <pre><p>Pls stop, if you don't know about it, don't say bs here</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传