Pipeline as Http Handler
A pipeline can serves as a http handler with Go standard net/http
.
The following example code demonstrates a simple web service that retrieves and returns the CPU usage of the system.
To run the example server, execute the following command in your terminal:
Once the server is up and running, you can make a request to the /cpu
endpoint by treating it as a RESTful API call. Use the appropriate HTTP method and include the endpoint URL in your request.
For example, you can use the curl
command to make a GET request to the /cpu
endpoint:
Last updated