<p>I'm teaching myself how to write a website from scratch using templating and a router.</p>
<p>my templates work, my router works when each are independent from one another. However, when I use my router to try to render a template, to render my template I created a package that does it and imported it, I get a huge mess of red errors that I can't understand.</p>
<p>I think the issue may be caused by my router using :8080, which is the same port my render package uses to launch its web server.</p>
<p>like I mentioned, when each are separated from one another they work perfectly fine its only when I use the router that triggers a template that I get an issue.</p>
<hr/>**评论:**<br/><br/>jeffbmartinez: <pre><p><a href="https://golang.org/doc/articles/wiki/" rel="nofollow">Writing Web Applications</a> is a great resource for writing a webpage from scratch using Go.</p>
<p>It walks you through building a simple wiki using go's <code>http</code> and <code>template</code> standard libraries.</p></pre>shovelpost: <pre><blockquote>
<p>I think the issue may be caused by my router using :8080, which is the same port my render package uses to launch its web server.</p>
</blockquote>
<p>Why are you using two servers? The package you import should expose an <code>http.Handler</code> which you will then use in <code>main.go</code> as a second argument to <code>http.ListenAndServe(":8080", handler)</code>.</p></pre>peepdippn: <pre><p>ahh, that makes sense.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传