Object/relational mapping is the Vietnam of Computer Science. – T. Neward (The Vietnam of Computer Science, June 6, 2006; see also Object-Relational Mapping is the Vietnam of Computer Science, J. Atwood, June 26, 2006)

I am getting frustrated by the number of people calling any HTTP-based interface a REST API. Today’s example is the SocialSite REST API. That is RPC. It screams RPC. There is so much coupling on display that it should be given an X rating. – R.T. Fielding, Untangled, 2010.

In this lab, you’ll build a web-based data service.

Building a Data Service

Azure supports NodeJS applications that implement data services.

Exercise 9.1

Using the Monopoly data service as a model, create a data service for your own monopoly database (from labs 7 & 8) and deploy it on Azure.

  1. Push your service code to a new GitHub repo. Notes:
    • This is a stand-alone repo, not your standard cs262 repo.
    • You’ll rebuild the .github/workflows and package-lock.json files later, so it’s safer to leave them out at this point.
    • Update the Node version in package.json to a more current version, and make sure to use that everywhere.

  2. Do the following in Azure:
    1. In the list of App Services, Create a new “Web App”.
    2. Under Basics, use your free student account (created in the guide exercises); create a resource group; give the service a unique name; choose a Node-based stack; set a free pricing plan (i.e., something like “Free F0 (shared infrastructure)”).
    3. Use the defaults for everything else and Review + create the app.

  3. In the new app service, do the following:
    1. Under Deployment CenterSettings: Enable GitHub deployment; enter your GitHub service repo details.
    2. Under ConfigurationApplication Settings and add separate key-value pairs for your Azure PostgreSQL database:
      • DB_SERVER — See “Server Name”, e.g., calvin-cs262.postgres.database.azure.com
      • DB_PORT — For PostgreSQL, always 5432
      • DB_USER — See the “Server admin login name”
      • DB_PASSWORD — Hopefully, you remember this!
      • DB_DATABASE — See the “Databases” page.
      Note that this approach allows us to keep these values out of our (public) GitHub repo. Also, add a key-value pair for NODE_ENV : production.

See the README file for details. Update that README.md file to link your service URL, which should provide endpoints that match the following:

For grading purposes, push the following into a cs262/lab09 sub-directory in your standard course repo:

If you get a server error (i.e., HTTP 500 Internal Server Error), there is something going wrong with Web app, often a database access error. The Web server won’t give details because that would give away important details about the service to the public. You, as the developer, can see the actual error by going to the Web service and checking the execution log stream. E.g., for Azure, look under the Overview (tab on the top) → Logs (tab toward the bottom in the middle).

Team Work

Running a Sprint Retrospective and Planning Session

Be sure to consider your preliminary design presentation as part of this planning exercise.

Exercise 9.2

You should actively participate in your team’s retrospective and planning session.

Checking in