How it works...

Once the command has executed successfully, the web application will run on the default Beego port 8080.

Next, we will execute a request to get all the employees by executing the following command:

$ curl -X GET http://localhost:8080/employees[  {    "id": 1,    "firstName": "Foo",    "lastName": "Bar"  },  {    "id": 2,    "firstName": "Baz",    "lastName": "Qux"  }]

Once the command has executed successfully, we can see the IP and timestamp printed in the application logs on the console, as follows:

Using beego.InsertFilter("/*", beego.BeforeRouter, filters.LogManager) , we inserted a filter in an application which executes for the URL pattern ...

Get Go Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.