WebFund 2013F: Tutorial 12

From Soma-notes
Jump to navigation Jump to search

In this tutorial you will be examining and modifying db-demo, a simple database demo using Mongoose to connect to MongoDB. Note this demo currently implements a simple database backup/restore and record insertion; you will be adding other functionality to it through this tutorial.

Download the application and run it as usual. (Note the modules are included.) To get full credit for this tutorial, do at least two of the following. (You'll get 3/4 if you do just one.)

  • Implement the list people functionality, returning each person stored as an item in an ordered list on a new page. Thus you'll have to implement the list() function in routes and you'll have to create a new Jade file, list.jade.
  • Make all of the pages have a style similar to that of the add person page (i.e., style them using Bootstrap).
  • Add a search option that returns only the people that match a user's query. You only need to implement restricted queries, say allowing the lookup of specific names or birthdays. See the Mongoose documentation on queries for more information. You only need to return a json object (as the backup() function does).
  • Modify the application so it doesn't use bodyParser() (and thus no longer generates the error) but still handles the uploading of files. (This one may be tricky.)