First Route, API, and HTML Response

Create your first API, its handler, and HTML response in the Beego application.

In this lesson, we will create a simple API that will be routed to a controller function, and a simple HTML template will be rendered as a response.

Defining the route

Let’s create a new API called GET /hello. All the APIs are listed in the file routers/router.go. We will add our API here and map it to its handler, a controller function.

Get hands-on with 1400+ tech skills courses.