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 couple of commands to see how the session works. Firstly, we will access /home by executing the following command:

$ curl -X GET http://localhost:8080/home 

This will give us an unauthorized access message as a response from the server:

You are unauthorized to view the page.

Apparently, we can't access it because we have to login into the application first, which will create a beegosessionID. Now let's log in to the application by executing the following command:

$ curl -X GET -i http://localhost:8080/login

This will result in the following response from the server:

Now we will use the cookie ...

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.