Develop a personal blog using the Beego framework (i)

Source: Internet
Author: User

Installation configuration

You need to install configuration Golang and then install Configuration Beego, which beego is a way to use Go thinking to help you
Build and develop an open-source web development framework for Go applications, beego with friendly Chinese documents, see Beego
After the installation configuration is complete, use the bee command to create the project

Description: Using Beego framework Development, background database is MongoDB, edit is Mardkdown

bee new blog// 目录结构如下├─conf├─controllers├─models├─routers├─static│  ├─css│  ├─img│  └─js├─tests└─views

Use bee run , please open it in the browser 127.0.0.1:8080 to see the effect

Markdown Editor

Use Simplemde to customize the personal Markdown Editor, SimpleMDE refer to this article for related configuration
beegoFramework default support suffix Yes tpl and html template

    • Create editor.html in views
    • Introducing in Staticsimplemde.min.css

For simplemde.min.css a little makeover, add a title and publish button, default full screen and display the preview screen,SimpleMDE
The core configuration is as follows:

  var simplemde = new SimpleMDE({        element: document.getElementById("editor"),        status: false,        autoDownloadFontAwesome: false,        tabSize: 4,        renderingConfig: {            codeSyntaxHighlighting: true        },    });  simplemde.toggleSideBySide();

To add a Editor controller

controllersAdd a file ineditor.go

package controllersimport "github.com/astaxie/beego"type EditorController struct {    beego.Controller}func (this *EditorController) Get() {    this.TplName = "editor.html"}

Add the corresponding route

routers/router.goadd a route map in

beego.Router("/editor", &controllers.EditorController{})

Enter an address in the browser to 127.0.0.1:8080/editor see the effect

Full source

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.