Skip to content

Instantly share code, notes, and snippets.

View subtainishfaq7175's full-sized avatar

Subtain Ishfaq subtainishfaq7175

View GitHub Profile
@subtainishfaq7175
subtainishfaq7175 / RESTfulConventions.md
Last active April 8, 2020 14:23
Best Practices for Designing a Pragmatic RESTful API

Rest API

Request/URL

The URL is a sentence, where resources are nouns and HTTP methods are verbs.

  1. The URL should only contain resources(nouns) not actions or verbs. The API path/addNewEmployee contains the action addNew along with the resource name Employee.
  2. The resources should be plural ,not singular Employees is right. Employee is wrong.
  3. To tell server , what to do , whether to add or delete , we have HTTP Methods /Verbs.
@subtainishfaq7175
subtainishfaq7175 / flatten.js
Created October 19, 2016 11:33
flatten the array
function flatten(arg) {
const flatit = [].concat(...arg);
return flatit.some(Array.isArray) ? flatten(flatit) : flatit;
}