Go/revel Tutorial: Building the Go Web framework Revel application on the browser (using the Paizacloud IDE)

Source: Internet
Author: User
Tags button type html header
This is a creation in Article, where the information may have evolved or changed. [Gopher] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323134353.png) The features of the Go language (Golang) are:-The standard library has many features, such as a network. -Easy to write concurrent programs. -Easy to manage executables (because there is only one file) the Go language has become increasingly popular in web development due to these features. As shown, we can see the extent to which Go is being watched at Google Trends. [From Google Trends] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323105259.png) from [Google Trends] (Https://trends.google.com/trends/explore?date=2010-02-23%202018-03-23&q=golang) Although Go itself comes with a rich library of standards to help us build the web Applications, but using the Web application framework makes it easier to develop fully functional Web applications. There are many web frameworks for Go: Revel, Echo, Gin, Iris, and so on, * * where Revel is one of the most popular full-stack Web application frameworks * *. The Go framework Revel's web development features are: routing, MVC, and generators. By building apps according to Revel rules, you can easily create WEB applications that are readable and extensible. In Revel, you can also use an or map library (such as Gorm). However, to develop Revel applications in practice, you need to install and configure Go, Revel, Gorm, and databases. These installations and settings are cumbersome. Errors are often caused by installation instructions only, or due to OS, version, and software dependencies. Similarly, if you post this service, the feedback from friends and other people can really drive you to the full. However, this service also needs to be "deployed". "Deployment" is also very difficult to engage in. So, [Paizacloud] (https://paiza.cloud/) This cloud IDE was born. This is a browser-based online web and application development environment. * * Due to Paizacloud owning Go/revelApplication development environment, so you can start writing your go/revel application directly in your browser * *. * * Because you can develop on the cloud, you can run and deploy Go/revel applications on the same machine without having to configure a server * *. Now, let's use Go and Revel to develop a task list application on the Paizacloud IDE. Follow the instructions below, * * You'll be able to create and run the Google Home app in just 10 minutes * *. # # Start: [Paizacloud Cloud IDE] (https://paiza.cloud/en/) [here] (https://paiza.cloud/) is [Paizacloud Cloud IDE] (https:// paiza.cloud/) 's website.! [Paiza Cloud] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20171214154059.png) can be registered by email, and click on the link in the confirmation email. You can also use GitHub or Google account to register. # # Create a server on the development workspace, we create a new server. [New Server] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20171214154558.png) Click ' New Server ', A dialog box opens to set up the server. Here, you can select ' PHP ', ' phpMyAdmin ' and ' MySQL ' and click on ' New Server ' button. [Server Settings] (Https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20171214154330.png) in just 3 seconds, You have a browser-based go/revel development environment. You will see the Editor or browser window in the page, so we can close them first. # # Setting up the environment now let's set the environment. Since Paizacloud already has the Go language and MySQL installed, you can run the ' go get ' command directly to install the other packages. In the [Paizacloud Cloud IDE] (HTtps://paiza.cloud/), you can run the command in the browser, using Paizacloud's application ' Terminal '. On the left side of the page, click the ' Terminal ' button. [Terminal] (Https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20171214154805.png) Now we've started the ' Terminal Program We are now going to enter ' go get [package name] ' command on the terminal. ' [Package name] ' is the name of the installer. Here, we will install the appropriate packages for Revel and Gorm. We entered: "' bash$ go get github.com/revel/revel$ go get github.com/revel/cmd/revel$ go get github.com/jinzhu/gorm$ go get gith Ub.com/go-sql-driver/mysql "! [bash] (Https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323105536.png) Now, we have installed the package in the ' ~/ Go/bin '. # # Create an app next, let's create your Go/revel app. You can use the ' Revel New ' command to create a go/revel app. In the [Paizacloud Cloud IDE] (https://paiza.cloud/), you can use the Paizacloud application ' Terminal ' to run commands in the browser. On the left side of the page, click the ' Terminal ' button. [Terminal] (Https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20171214154805.png) Now we've started the ' Terminal Program We are now going to enter ' Revel new [application name] ' command on the terminal. ' [Application name] ' is the name of the program you created. You can use the name you like, like ' Music-app ' or ' Game-app '. Here, I name the program ' MyApp ', which is used to manage the task list. Enter: ' ' bash$ revel new MyApp '! [Revel New MyApp] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323111349.png) In the File Manager view on the left side of the page, You can see the ' Go/src/myapp ' directory. Click on the folder and open it to see what's inside. [File Manager view] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323110203.png) You'll see a lot of go/inside. Revel file. # # Open Revel server now, you can run the program. Let's start the program. After entering the ' CD ~/go ' command to switch directories, enter ' Revel run MyApp ' command to open the server! "' bash$ CD ~/go$ Revel run MyApp '! [Revel Run MyApp] (Https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323111505.png) on the left side of the page, a new button appears, Display text ' 9000 '.! [Button 9000] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323111533.png) The Revel server will run on port 9000. [Paizacloud Cloud IDE] (https://paiza.cloud/) monitors this port number (9000) and automatically adds a button to open the browser on this port. Clicking on this button will show the browser program (the browser application in Paizaclound). Now, you can see the Revel page, this is your app!! [Your Web page] (Https://raw.githubusercontent.com/studygolang/gctt-images/mastEr/go-revel/20180323111629.png) (although Revel is running as an HTTP server, Paizacloud will convert HTTP to HTTPS.) # # # Edit the file you see in this app's page is actually an HTML file, ie ' ~/go/src/myapp/app/views/app/index.html '. Let's try to edit the file and change its title. On the File Manager view, double-click the ' ~/go/src/myapp/app/views/app/index.html ' file for editing. [Index.html] (https://raw.githubusercontent.com/studygolang/gctt-images/master/go-revel/20180323111814.png) Edit the title section and put the ' It works ' Replace with the following: ' go/src/myapp/app/views/app/index.html ': ' Html

Via:http://engineering.paiza.io/entry/paizacloud_golang_revel

Author: Tsuneo Translator: Noluye proofreading: polaris1119

This article by GCTT original compilation, go language Chinese network honor launches

This article was originally translated by GCTT and the Go Language Chinese network. Also want to join the ranks of translators, for open source to do some of their own contribution? Welcome to join Gctt!
Translation work and translations are published only for the purpose of learning and communication, translation work in accordance with the provisions of the CC-BY-NC-SA agreement, if our work has violated your interests, please contact us promptly.
Welcome to the CC-BY-NC-SA agreement, please mark and keep the original/translation link and author/translator information in the text.
The article only represents the author's knowledge and views, if there are different points of view, please line up downstairs to spit groove

475 reads ∙1 likes
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.