Testing the App Endpoints with cURL

Learn to test an app by hitting the endpoints with HTTP requests and getting the expected response.

How to test an app

There are several kinds of tests to check if an application works. Some of the major ones are:

  • Unit testing: Unit testing tests a small piece of code, usually a function in isolation.

  • Integration testing: Integration tests are done at a higher level, usually involving more than one module or unit in the workflow. For example, if an app interacts with the database, integration tests will actually send queries to the database.

  • E2E testing: E2E or end-to-end testing, as the name suggests, tests the entire workflow of the app and includes all the components.

  • Manual testing: Manual testing in an app is usually fiddling with the UI of the app and trying out the features manually.

Tools to test an app

Earlier, we tested our server code using some HTML and ran it in a browser. This is a form of manual testing. But what if a web app doesn't have an interface or the front-end part of the app is not ready yet?

There are quite a few tools available that can be used to directly send requests to our web app. Let's look at two of the most common ones.


The testing software cURL (cURL stands for “client URL.”)client URL is basically a piece of software that provides both libraries and a command-line tool to send data by creating and sending requests using various protocols, including HTTP. It is, by far, one of the simplest and quickest ways to test the API endpoints since it can be downloaded very easily.


Postman is third-party software used for building, testing, and using APIs. It has a user interface that makes it much easier for a user to form requests. No more clunky command-line interface (CLI) tools! It's pretty feature rich and also has the option to create API collections and save them. These can then also be downloaded and shared, making collaborations among developers quite easy.

Test all endpoints with cURL

The testing software cURL can be installed pretty easily. We'll use it to test our endpoints because it's easy to use and because in most production environments, we don't have the luxury of installing a tool with a UI.

We have the following endpoints in our web app so far:

  • /ping

  • /coffee

  • /home

Let's test them one by one. Make sure the server is running by running the app's main.go function we wrote in previous lessons.

/ping endpoint

We can compose an HTTP request using cURL as follows:

Get hands-on with 1200+ tech skills courses.