- 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
- Copy the
models/shops.jscreate a set of functions to perform the following:
|getShops||n/a||list of shops|
Each coffee shop should have the following schema:
- name (string)
- employees (number)
- currentlyOpen (boolean)
Create Web Server
- Copy the
controllers/shops.jscreate as set of HTTP request handlers to do the following:
|path||Method||model function to call|
- 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.
- create an other model called employees. Create a controller for these employees
- add a key to the employees model called
shopIndex. Add a method that will get all employees given the value of
- Write an controller function that uses the function from the previous step.