O'Reilly logo

Learning AngularJS by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing a Database Access Service

In this example you will build an intermediate database access service that uses the $http service to connect to a simple Node.js server that will act as a server-side database service. The purpose of this exercise is to illustrate the usage of built-in services alongside custom services. This also gives a good example of utilizing the $q service.

Listing 10.5 implements the Node.js web server that handles the following GET and POST routes to get and set a user object and an array of table data to simulate making requests to a remote database service:

/get/user: A GET route that returns the JSON version of a user object.

/get/data: A GET route that returns the JSON version of an array of table data. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required