This is a creation in Article, where the information may have evolved or changed.
Website on-line operation and summary
Test run
In the previous section, we finished all the service-side code, so let's try running it first.
Start the service
go run main.go
The following information will be printed:
start...,port:8888, visit: http://localhost:8888
Description, our service is running.
Browser input Access
http://localhost:8888
The "Quick News homepage", which we set up in our route, is running perfectly.
Get a piece of news data under test
http://localhost:8888/getnewsbyid?id=1
The browser will print out the following information:
{ "data": { "content": "新闻啊新闻新闻啊新闻", "created_at": "2018-01-23 16:31:53", "id": 1, "status": 1, "updated_at": null }, "msg": "success", "status": 200}
The data service is also a perfect success
Deploy on-line
When it comes to deployment, go is one of the easiest projects I've ever seen, and there are several ways to do it on the web, and here's a simple example.
Packaging services
go build main.go
Running the service
nohup ./main &
Yes, that's it, it's running, it's gone.
Summarize
This series of tutorials just made a simple example of a Web site process and played a starting effect.
Specific use of the process, according to their own needs, to make the appropriate adjustments can help people seeking to get started quickly through the two-pulse bar
Description: As far as the front page, I write casually, I use the
vue
front-end framework here, follow-up opportunities, I will record this process, temporarily first, the source is together
The project Source: Https://github.com/gohouse/kuaixinwen