Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 495 Bytes

API.md

File metadata and controls

35 lines (29 loc) · 495 Bytes

Using the API

const apiUrl = '/api/filters';

// Fetching all filters
superagent
  .get(apiUrl)
  .end(function(err, res) {
    const filters = res.body;
    (...)
  });

// Creating a filter
superagent
  .post(apiUrl)
  .send({
    color: 'yellow',
    name: 'Trump'
    text: 'Trump',
    hashtags: ['Trump']
  })
  .end(function(err, res) {
    (...)
  });

// Deleting a filter
superagent
  .delete(`apiUrl/${filter.name}`)
  .end(function(err, res) {
    (...)
  });