Skip to content

Latest commit

 

History

History
296 lines (205 loc) · 2.61 KB

markdown_layouts.md

File metadata and controls

296 lines (205 loc) · 2.61 KB
Families of Musical Instruments
~/public/ **index.html**

~/src/helpers/ **text_format.js**

~/src/models
**person.js**

**random_adjective.js**


~/src/ **app.js**


Teas & Biscuits - Express Rest API
~/client/public/ **index.html**

~/client/src/models/ **consumables.js**

~/client/src/helpers
**pub_sub.js**
const PubSub = {
  publish: function (channel, payload) {
    const event = new CustomEvent(channel, {
      detail: payload
    });
    document.dispatchEvent(event);
  },

  subscribe: function (channel, callback) {
    document.addEventListener(channel, callback);
  }
};

module.exports = PubSub;

**request.js**
const Request = function (url) {
  this.url = url;
};

Request.prototype.get = function () {
  return fetch(this.url)
    .then((response) => response.json());
};

Request.prototype.post = function (payload) {
  return fetch(this.url, {
    method: 'POST',
    body: JSON.stringify(payload),
    headers: { 'Content-Type': 'application/json' }
  })
    .then(response => response.json());
};

module.exports = Request;


~/client/src/views
**form_view.js**

**list_view.js**


~/client/src/ **app.js**

~/server
**server.js**

/routers/ **biscuits_router.js**

/routers/ **index_router.js**

/routers/ **teas_router.js**



Gif