What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-01 01:31:07
How to use fetch api
//Obj of data to send in future like a dummyDb const data = { username: 'example' }; //POST request with body equal on data in JSON format fetch('https://example.com/profile', { method: 'POST', headers: { 'Content-Type': 'application/json', }, ... Add solution -
Python 2021-09-30 03:43:05
python send image in post request with json data
import base64 import json import requests api = 'http://localhost:8080/test' image_file = 'sample_image.png' with open(image_file, "rb") as f: im_bytes = f.read() im_b64 = base64.b64encode(im_bytes).decode(&quo... Add solution -
Javascript 2021-09-29 22:29:02
invoke xstate
// Function that returns a promise // This promise might resolve with, e.g., // { name: 'David', location: 'Florida' } const fetchUser = (userId) => fetch(`url/to/user/${userId}`).then((response) => response.json()); const userMachine = Machine({... Add solution -
Javascript 2021-09-28 13:32:03
fetch get request
//Obj of data to send in future like a dummyDb const data = { username: 'example' }; //POST request with body equal on data in JSON format fetch('https://example.com/profile', { method: 'POST', headers: { 'Content-Type': 'application/json', }, ... Add solution -
Javascript 2021-09-27 23:12:05
promise.all map statement
//Here i have filmresponse.json() which will return promise so i uses promise. //all otherwise it won't be possible to run it let characterResponse = await fetch('http://swapi.co/api/people/2/') let characterResponseJson = await characterResponse.json()... Add solution -
Javascript 2021-09-27 22:41:03
weather api javascript
// Full tutorial: https://www.youtube.com/watch?v=WZNG8UomjSI fetch( "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=metric&appid=" + apiKey ) .then((response) => response.json()) .th... Add solution -
Javascript 2021-09-26 08:45:02
build a weather app javascript
// Full tutorial: https://www.youtube.com/watch?v=WZNG8UomjSI fetch( "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=metric&appid=" + apiKey ) .then((response) => response.json()) .th... Add solution
Best helpers
Ranking is empty