This is a creation in
Article, where the information may have evolved or changed.
First download Revel
go get -u github.com/revel/cmd/revel
Create an App
#假设GOPATH = /GOPATHcd /GOPATHrevel new coding.net/revel-example
The above command creates an app named Coding.net/revel-e
This is a creation in
Article, where the information may have evolved or changed.
Revel is a typical MVC framework that uses the command Revel new [appname] to create a Revel project with the default structure:
App
| CONTROLLERS-MVC mode controller, receiving client request to complete the logical processing and return the rendered result-html,json,xml ...
| R
This is a creation in
Article, where the information may have evolved or changed.
First Bing a blog post, refer to To download the installation, the first step go get run Error:
go:missing Mercurial command.
See the error message is the source Code control tool is not pre-installed, simply go to the official website to view
Http://robfig.github.io/revel/tutorial/gettingstarted.html ,
sure enough, the installation wizard is very detailed, from t
) history () Revel. Result {return C.render ()}
OK, add our route below, Conf/routes:
GET /history app.history
Look at the effect:
Let's implement it and create a new history.go content inside models:
Package Modelsimport ("Github.com/revel/revel", "Labix.org/v2/mgo/bson" "Time") type history struct {year Intblogs []blog }f
1.app/controllers/app.go ControllerPackage Controllersimport"Github.com/revel/revel"type Appstruct { *Revel. Controller}func (c App) Index () Revel. Result {str:="pass a variable to the template to see" returnC.render (str)}func (c App) Hello (Namestring) Revel. Result
This is a creation in
Article, where the information may have evolved or changed.
This article introduces the setting up of node. js, Golang and other environments under Ubuntu, and the difference between MAC installation is only two points:
When installing Golang dependent libraries, use brew install xxx instead sudo apt-get xxx ;
When installing Golang, do not need to download the source code compilation and set PATH, only need to download go pkg file on Golang official website, doubl
) history () Revel. Result {return C.render ()}
OK, add our route below, Conf/routes:
GET /history app.history
Look at the effect:
Let's implement it and create a new history.go content inside models:
Package Modelsimport ("Github.com/revel/revel", "Labix.org/v2/mgo/bson" "Time") type history struct {year Intblogs []blog }f
Used to write the node server API, change to static type language very uncomfortable, rules a lot ~ to be dynamic required!!! Here are a few bags to note JSON conversion and parsing Github.com/bitly/go-simplejson Go get Github.com/bitly/go-simplejson Body conversion parsing with direct import Stringsio/ioutil Postman Submitting data {"Data": "Yes", "Hotel": ["Caonima", "Gelebi"], "HP": 10000000} Controller action data Post receive packagecontrollersimport ( "Github.com/
This is a created
article in which the information may have evolved or changed.
Because GFW reason, unable to download WebSocket source code, in fact, the source code in Git also, as long as the download down, and then Gopath write on the corresponding path can be compiled, the specific steps are as follows:
1. Clone the code on git to local, such as clone to home directory (~/)
git clone https://github.com/golang/net.git
2. Create the appropriate directory in Gopath, such as Gopath=~
This is a creation in
Article, where the information may have evolved or changed.
Demo Address http://gblog-revel.herokuapp.com/
1. Design the email Wall pageAh, what is the email wall ah, this, Bo Master, casually pull something, do not know to everyone West like, first to do, look at the effect behind it.
First create the emails.html content under Views/app:
{{set.} "title" "Email List-gblog"}}{{set. "EMA" "Active"}}{{template "header.html".}} Among them, the URL of the IMG in the string,
This is a created
article in which the information may have evolved or changed.
My go is 1.6.2 versionRevel source, go https://github.com/revel/revel , and then choose the version under which I use is revel-0.13.0Revel cmd, go https://github.com/revel/cmd and then choose the version under which I'm using thecmd-0.13.
This is a creation in
Article, where the information may have evolved or changed.
Demo Address http://gblog-revel.herokuapp.com/
1. HomeWell, I built our project with Revel New Gblog.
Before the design (why always design, no results no motivation AH), we first to do something. Will public/css/bootstrap.css deleted replaced by BOOTSTRAP3 (because it gives us 2, I like to use 3, can not say like, but is using 3, you can continue to use 2 Oh! Maybe the
This is a creation in
Article, where the information may have evolved or changed.
Demo Address http://gblog-revel.herokuapp.com/
1. HomeWell, I built our project with Revel New Gblog.
Before the design (why always design, no results no motivation AH), we first to do something. Will public/css/bootstrap.css deleted replaced by BOOTSTRAP3 (because it gives us 2, I like to use 3, can not say like, but is using 3, you can continue to use 2 Oh! Maybe the
This is a creation in
Article, where the information may have evolved or changed.
Unconsciously, the tutorial has been done, did not spend much time, the demo add up also on the appearance of 3 days, tutorials, also on 3 nights, EN, overall this attempt to go is still very rewarding, I did not like Class C language (including C) This is only a personal reason (may be related to the Enlightenment teacher), Please do not spray, I use C's people, are holding a respectful attitude. After this time l
This is a creation in
Article, where the information may have evolved or changed.
Unconsciously, the tutorial has been done, did not spend much time, the demo add up also on the appearance of 3 days, tutorials, also on 3 nights, EN, overall this attempt to go is still very rewarding, I did not like Class C language (including C) This is only a personal reason (may be related to the Enlightenment teacher), Please do not spray, I use C's people, are holding a respectful attitude. After this time l
This is a creation in
Article, where the information may have evolved or changed.
In fact, it can be said that the tutorial has basically ended.
But, do you remember the reminder in the top right corner of our home page? In this chapter, we'll do this thing.
It reminds you that there are updates within the last 1 hours. Well, first of all, there should be a way to query the Blog.go in time.
OK, open the Blog.go Add method:
Func (DAO *dao) findblogsbydate (start time. Time) Int{blogcollection: =
This is a creation in
Article, where the information may have evolved or changed.
In fact, it can be said that the tutorial has basically ended.
But, do you remember the reminder in the top right corner of our home page? In this chapter, we'll do this thing.
It reminds you that there are updates within the last 1 hours. Well, first of all, there should be a way to query the Blog.go in time.
OK, open the Blog.go Add method:
Func (DAO *dao) findblogsbydate (start time. Time) Int{blogcollection: =
In our lives, automatic login for account is already very common, so use the filter to achieve this function.
The main introduction of the user's automatic login and cancellation of automatic login, as well as the implementation of a day automatic login or n-day automatic login
The cause of the error occurred. SSH Directory Permissions issuesFile permissions error under. ssh/PathThe client uses a key error to detect if the key is correctCheck the. SSH directory permissions, must be 700LL. SSHdrwx------2 root root 4096 January 16:34 sshDetection. ssh/path file permissions, Id_rsz.pub and Authorized_keys permissions 644, or (ps:.ssh/path can only have authorized_keys files, the client takes the server private key to log on)LL. ssh/-rw-r--r--1 root root 397 January 15:41
I know it is through the session to judge, that is, after the session through the template how to become a user login information?
Reply to discussion (solution)
User information is fully written to the session template determines whether the user information in the output session or the login box
I usually use the session to judge the corresponding state of the content, if you want to better effect
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.