bonfy / go-mega Goto Github PK
View Code? Open in Web Editor NEW✨🤟✨Go-Mega Tutorial for Go Web Develop | Demo: https://go-mega.herokuapp.com
Home Page: https://go-mega.bonfy.im
License: Other
✨🤟✨Go-Mega Tutorial for Go Web Develop | Demo: https://go-mega.herokuapp.com
Home Page: https://go-mega.bonfy.im
License: Other
Hello,作者您好!我在学习您这个项目过程中自己仿照了一个项目(代码基本一样,结构稍有改动)。在第八章第九章的例子中我使用您项目中的前段代码,发现在渲染的时候没有出现 follow
、 old
等关注、分页的按钮。为了避免是自己的问题,我做了以下检查:
后来想可能是兼容问题?(前端一点都不了解,瞎猜的)直接在 url 后面加类似于 ?page=2
这样的参数,发现能成功显示分页的内容。
结果如下图所示,第一张是不加 page
参数的截图,第二张是加了 page
参数的截图,第三张是 follow
和 unfollow
按钮无法正常显示出来的页面:
综上,想请教一下作者怎么修改才能完整地显示您教程上面的前端页面?十分感谢!
现在很多项目前后端分离了吧,go适合写 restful api 吗?
第二章提到的 templates 没有说明在哪里创建
$ mkdir templates
比如我是在 main.go
所在的目录创建的,这样的话直接运行会报错,需要把路径改成相对路径:
tpl, _ := template.ParseFiles("./templates/index.html")
使用gorm 自引用多对多关系,如何反向查询呢?
比如:用户互相关注的表
Followers []*User `gorm:"many2many:follower;association_jointable_foreignkey:follow_id"` //用户关注表,自引用多对多关系。
查询用户的关注列表好做,如何查询关注用户(也就是用户的粉丝)列表?
可以提一下html字符串的反引号:用来创建原生的字符串字面量,这些字符串可能由多行组成(不支持任何转义序列),原生的字符串字面量多用于书写多行消息、HTML以及正则表达式
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.