<p>I am excited by the possibilities of Go. But I am need of a good resource to help me learn.</p>
<p>As someone with no Go background at all but a background in PHP and MySQL I am kind of understanding what I am reading on the Gin website but I could really do with a super comprehensive hold-my-hand guide on how to build a full website (not an api) with stuff like user logins, session management, CRSF, input validation etc all covered.</p>
<p>Any books or tutorials? I really want to learn Gin because of it's high performance and it seems like I'll learn more about under the hood compared to another framework?</p>
<p>It seems like a lot of packages have been written which are great. Is there a definitive list of packages? i.e. best one for handling CRSF, best one for sessions, best on for preventing XSS, validating JSON etc.</p>
<p>About my background I have been a web developer for 5 years and know html, css, php, javascript and use both windows and linux.</p>
<p>Thank you</p>
<hr/>**评论:**<br/><br/>koalefant: <pre><p>not a framework, but the Gorilla toolkit is useful for composing elements of what you want <a href="http://www.gorillatoolkit.org">Gorilla Toolkit</a>. Used it myself when starting out and implemented the session management, logins etc in less than 20 lines of code.</p></pre>yarrowy: <pre><p>I was looking for something like this too but had no luck finding any.</p></pre>no1youknowz: <pre><p>Try checking out the issues list. There are a lot of people asking for help to do certain things.</p>
<p>Like you, I am coming from a php background. I got frustrated with gin as it doesn't come with MVC out of the gate. Even though there are issues asking for this, it hasn't been implemented.</p></pre>elithrar_: <pre><blockquote>
<p>Like you, I am coming from a php background. I got frustrated with gin as it doesn't come with MVC out of the gate. Even though there are issues asking for this, it hasn't been implemented.</p>
</blockquote>
<p>What do you consider as "MVC"? MVC is just a design pattern—a framework can't 'come with' MVC. If you mean you want an ORM tool built-in, that's a different thing entirely, and the library author electing to keep some features out is totally OK.</p>
<p>Gin certainly doesn't preclude you from choosing your own ORM layer, or eschewing an ORM and going for sqlx or mgutz/dat.</p></pre>no1youknowz: <pre><p>No, I don't mean having an ORM built in. Personally, I think ORM has no place in a framework at all.</p>
<p>Go look at something like codeigniter for PHP. You are right about MVC, so codeigniter is a framework built around that MVC pattern.</p>
<p>It has a file for routes. You put your controllers in a certain directory, same for models, same for views. You can even have business code in a libraries folder.</p>
<p>You don't have to do much work to develop applications VERY FAST. This is the key for an MVC framework, you don't have to put too much thought in how everything is wired up. It just works.</p>
<p>I don't have time to pontificate and write boilerplate code over and over and over again with my go projects and using the standard net/http package.</p>
<p>I've must have written 30 micro-services in golang now. A lot of it is duplicated functionality. </p>
<p>I would love to see something where I can jump in and write things much quicker than I am currently writing on golang. </p>
<p>Honestly, until you write stuff in a high level language (think rails or php) and start to knock things out in a matter of hours. I think some people won't get the problem here.</p>
<p>Maybe I may just end up writing something for myself. I've shelved a previous effort so far. Too busy with other things that actually are making money.</p>
<p>Thats the problem I have. Other things make money, time spend developing an mvc for golang does not.</p></pre>antonb90: <pre><p>If you wrote 30 micro-services, you could have written 1 abstraction layer to make that easier for you so you stop duplicating code. That way it will end up being the only "boilerplate" that you describe. </p>
<p>The whole point of Go is to make it easier to get started with the packages that come with Go. This means that you SHOULD write your own abstraction layer for YOUR use case. </p>
<p>First of all Rails is a framework, Ruby is the language - you said "think Rails or PHP", but Rails and PHP are two different things. You should of said "think Ruby or PHP"...</p>
<p>Either way, "MVC" is just an abstraction, you can write it yourself very quickly in Go (alot quicker then you think). Codeigniter holds your hand so does Rails... </p></pre>tvmaly: <pre><p>I build the core services of bestfoodnearme.com with gin. I would recommend looking at the examples and then the middleware examples. Start out small and build just one thing. use the standard template library. I would be more than happy to answer any specific questions you have</p></pre>elithrar_: <pre><blockquote>
<p>Any books or tutorials? I really want to learn Gin because of it's high performance and it seems like I'll learn more about under the hood compared to another framework?</p>
</blockquote>
<p>Note that the 'high performance' of Gin is a bit of a trick: where it's fast (routing) is almost irrelevant to all other parts of your application, like template rendering and DB connectivity. A few <em>nanoseconds</em> (thousandths of a millisecond) on your router will not change things, and focusing on router benchmarks is a bit of a trap for newcomers.</p>
<p>I'm not sure whether you'll learn 'more' about under the hood: Gin exposes (in fact, it wraps/hides) the same <code>http.ResponseWriter</code> interface and <code>*http.Request</code> struct as nearly all other 'frameworks', from Go's standard net/http onwards. If anything, you end up relying on Gin's types/interfaces and packages more than those out in the wider Go community, making it harder to move away/change if you want to.</p></pre>antonb90: <pre><p>I keep telling everyone Go provides all of the packages you need to develop your own framework / library / architecture... It seems like newcomers are used to having their hand held by massive frameworks like Djano, Rails, Laravel... etc.</p></pre>
Best resource to learn how to use Gin framework to build a website? (complete Go noob)
blov · · 838 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传