Using HTTP "Delete" method in REST API on Vercel
We can use HTTP DELETE
method instead of POST
to implement deleting of data from a database in a REST API...
We can use HTTP DELETE
method instead of POST
to implement deleting of data from a database in a REST API...
Serving a static json file from an API endpoint using a serverless Node.js function...
In this blog post I explain how to secure an API with OAuth 2.0 authorization framework as well as implementing changes in a Web app/page to allow users access to that API. This implementation uses JavaScript in frontend and backend (Node.js)...
Did you know that a HTML anchor element can be treated as a Location object? This means similar to how you can use window.location to read or write different parts of a URL, you can do the same with an anchor element. For example if you have a link like this:
<a id="myLink" href="https://mydomain/products.html?category=clothing#productName">test</a>
You can get the value of hash in this way:
const hash = document.getElementById('myLink').hash.substring(1); // returns productName
You can use different properties of Location object on an anchor element and same as with window.location you can both read and write these properties. For example to get the value of category from previous link you can use this:
const params = document.getElementById('myLink').search;
const category = new URLSearchParams(params).get('category'); // clothing
For more info see: https://developer.mozilla.org/en-US/docs/Web/API/Location