Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node-fetch post request example

let todo = {
    userId: 123,
    title: "loren impsum doloris",
    completed: false
};

fetch('https://jsonplaceholder.typicode.com/todos', {
    method: 'POST',
    body: JSON.stringify(todo),
    headers: { 'Content-Type': 'application/json' }
}).then(res => res.json())
  .then(json => console.log(json));
Comment

make post request POST with node-fetch

npm install --save node-fetch
Comment

PREVIOUS NEXT
Code Example
Javascript :: format amount in javascript 
Javascript :: 1line uuid 
Javascript :: javascript confirm yes no 
Javascript :: get current url host name in javascript 
Javascript :: "https://cdn.socket.io 
Javascript :: emmet not working in react nextjs 
Javascript :: android center text react native 
Javascript :: installing vuex 
Javascript :: datatables clear table 
Javascript :: python save list to json 
Javascript :: ready function jquery 
Javascript :: react install 
Javascript :: jquery when you typing in input 
Javascript :: remove extra space in string javascript 
Javascript :: change page from js 
Javascript :: jquery set href of link 
Javascript :: on scroll page jquery 
Javascript :: how to get year in react 
Javascript :: how to get the year in javascript 
Javascript :: get text selected option jquery 
Javascript :: jquery loop through each child element 
Javascript :: uppercase javascript 
Javascript :: how to change background image url in javascript 
Javascript :: unique objects in array javascript 
Javascript :: disable input field with jquery 
Javascript :: javascript convert px to vw 
Javascript :: how to convert seconds into days hours seconds js 
Javascript :: js remove the last character of a string 
Javascript :: get value of selected checkbox jquery 
Javascript :: count items in div jquery 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =