Skip to content
No description, website, or topics provided.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



  • Create an HTTP web wrapper around a set of model code.


Follow the instructions for setting up a new project from the mehn-template-project readme.

NOTE: be sure that server.js uses the express.json() middleware and not the express.urlencoded() middleware.

Create API

  1. Copy the models/template.js to models/shops.js
  2. In models/shops.js create a set of functions to perform the following:
function name parameters return
getShops n/a list of shops
getShop index single shop
createShop n/a new shop
addShop newShop n/a
deleteShop index n/a
updateShop index, shop n/a

Each coffee shop should have the following schema:

  • name (string)
  • employees (number)
  • currentlyOpen (boolean)

Create Web Server

  1. Copy the controllers/template.js file to controllers/shops.js
  2. In controllers/shops.js create as set of HTTP request handlers to do the following:
path Method model function to call
/shops GET getShops
/shops/:index GET getShop
/shops/new GET createShop
/shops POST addShop
/shops/:index DELETE deleteShop
/shops/:index PUT updateShop

Strech Goals

  1. Add some more methods to your model that modify the data inside of the coffee shop (such as adding a menu item or changing the name) and write an HTTP request handler around that.
  2. create an other model called employees. Create a controller for these employees
  3. add a key to the employees model called shopIndex. Add a method that will get all employees given the value of shopIndex.
  4. Write an controller function that uses the function from the previous step.
You can’t perform that action at this time.