December 2017
Intermediate to advanced
316 pages
6h 58m
English
To install httprouter, we just need to run the get command:
go get github.com/julienschmidt/httprouter
So, now we have httprouter. We can refer to the library in our source code as this:
import "github.com/julienschmidt/httprouter"
The basic usage of httprouter can be understood through an example. In this example, let us create a small API to get information about files and programs installed from the server. Before jumping straight into the program, you should know how to execute system commands on Go. There is a package called os/exec. It allows us to execute system commands and get the output back to the program.
import "os/exec"
Then it can be accessed in the code as this:
// arguments... means an array of strings unpacked ...
Read now
Unlock full access