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
Listing 10.5 implements the Node.js web server that handles the following
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. ...