Home >Backend Development >Golang >Is golang suitable for web development?
It is very convenient to use go language for web development. If you don't use a framework, you can quickly develop a web application by just using the net/http package. However, the official package does not support RESTful style API, so we still need to choose a framework to help us develop. (Recommended learning: go)
We enter web on github, select the go language project, and sort by the number of stars. There are probably the following projects. Popular in the community:
caddy gin beego martini gotty echo revel iris
It is worth mentioning that beggo is a project developed and maintained by Chinese people. As the initial learning stage, we chose the famous gin project to explore.
Golang’s web backend is much faster than php, ruby, and python even if it is not concurrent
Using concurrent in golang is really very convenient and very fast, and the cost of golang scale for very large web projects is low
If you want, golang deployment can be more convenient than php. You can use go get and http.ServeAndListen() without nginx and apache
Recompiling for file changes is actually not a big problem. Look at pilu/fresh · GitHub. In fact, you can write your own shell script (you can also write it directly in go, because it is a system language) to monitor file system changes and automatically rebuild it. Even for C/C projects, this is not a big problem. People don't use C/C to write web because they are not the best choice for writing web apps
After the code written in golang is compiled, it is more robust than the scripting language because the go compiler enforces some best practices
So if you are familiar with go or willing to invest time, this is a language worth using. If you are not familiar with it and the project cycle is very tight, it is recommended that you use the language you are most familiar with. Learning go itself takes time. .
My latest web project was written in Gorilla, and I was learning while doing it. Gorilla, the golang web toolkit; this Go by Example is quite useful.
The above is the detailed content of Is golang suitable for web development?. For more information, please follow other related articles on the PHP Chinese website!