Recently made a low-level error, Beego write API

Source: Internet
Author: User
Simple example code generated directly with the Bee tool, default.go This file as follows, the other has not changed, the output has been "{}", this is why?
Package controllers
Import ("Github.com/astaxie/beego")
Type Maincontroller struct {
Beego. Controller
}
Type mystruct struct {
Name string Age string
}

Func (this *maincontroller) Get () {
MS: = mystruct{"Tom", "25"}
This. data["json"] = &ms
This. Servejson ()

}

Beginning to think that is not so write, want to see Beego implementation code, can go or unfamiliar, look at the headache, ransacked a circle, found Xie Mengjun API programming ppt, feel no problem, odd strange.

Asked the group, did not respond, I am not too shy to ask again, just get restfulwebservice, read first


Look at the code today, unexpectedly found that the name and age do not have an initial capitalization, forget the rules of Go!!!, solve

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.