Pages

Tuesday, January 22, 2019

RESTful API methods: a typicl practice

When we are building RESTful API services, we can use the following methods for a certain actions.

Below we are mentioning a table of API methods, for example, for a Product entity.


Method
Example EndPoint
Meaning
GET
api/products
List of Products
GET
api/products/{id}
View a product
POST
api/products
Create New product
PUT
api/products/{id}
Update a product
DELETE
api/products/{id}
Delete a product



Friday, January 18, 2019

Mapping a constructed Javascript array

Array(100) produces vacant array. Execution of map function will lead undefined.
 
 We need to use spread operator to use map function successfully.
 
 
const arr = [...Array(100)].map((_, i) => i); 
 
 
Source: Shawn Reisner' blog entry