Alternatively, we can make GET requests using curl. Curl, short for Client for URLs, is a command line tool that allows us to transfer data to and from a server. It supports multiple protocols, including HTTP. You can read more about curl in our “What is curl?” article.

Curl is also useful for testing HTTP request methods from your local command line. Let’s say we want to test the HTTP endpoint http://www.mypetclinic.com/dogs/. We would use the curl command…

curl http://www.mypetclinic.com/dogs/

…which uses the GET request as the default method to retrieve the dogs resource from that URL; the dogs resource is displayed in the terminal rather than the browser. In doing so, we again confirm that our server is returning and displaying the information that we expect it to.



Again, let’s confirm that our restaurant app’s GET request is working by hitting the endpoint – this time, with a curl command:

curl localhost:4001/restaurants

You should see similar output as before.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?