Categories
Beego Golang

Build an app with Go Beego: Controller & Router (Pt. 1)

In this coding session, we will use Golang’s Beego web framework to build an API / Web app from scratch: controller & routers.

Build an app with Go Beego: Video Post + Interactive Code

In this coding session, we will use Golang’s Beego web framework to build an API / Web app from scratch. At the end of the post, you can find Repl.it code editor with the corresponding source code. This post is part of my Golang Beego Video Tutorial series.

Build an app with Go Beego: Controller & Router (Part 1)

Go Beego Coding Session

In this particular part, we will set a project goal and start a new Beego project. Even so, I am aiming for the API project. We will set up our demo with the bee new command, meaning that it will also include views.

What’s included in this part:

  • Bootstrap a new project with the Beego web framework.
  • Review the project’s structure: Model, View, Controller.
  • Introduce a new controller with its router and view.

Initial model structure:

Build an app with Golang Beego: Data Models and FKs
Data model for the project.

We aim for a very simple data model. Our main goal here is to introduce two entities and have one foreign key between them.

Based on these models, we will have the following API endpoints:

Build an app with Golang Beego: API Endpoints
Two API endpoints /posts and /categories.

Go Beego Project: Source Code

In this section, you can visit the source code for this project and check the interactive code editor below. In the live interactive editor, you can execute the application described in this video post.

Next

By Kanan Rahimov

Sr. Software Engineer

Leave a Reply