No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead of learn-co-students:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Integrate $http into CRUD service


  • Use a backend API to fetch data
  • Create public Service methods to match API intention


Let's create a service to query a stubbed API. To do this, we need stubby as a command line program.

We can do this with

sudo npm install -g stubby

Then, run stubby -d config.yml in your command line.

Now, we've got our mocked backend running. This has two endpoints under the url - we can issue both GET and POST requests to it.

Create a service that queries this endpoint inside a function named getUser, and returns the response from the API.

The service should also have a method to called updateUser to POST to this endpoint. This method should return the response from the API as well.