How to use it
Change API_URL to the ones you want
ALl Valid links
/users , /products , /countries
Due to prevent misusing of server we restricted some actions (deleting and updating first 20 elements )
GET ALL
const API_URL = "https://nihatapi.vercel.app/users"
fetch(API_URL).then( response => response.json() )
.then ( (data) => {
console.log(data)
} )
const API_URL = "https://nihatapi.vercel.app/users"
async function getAll (){
const response = await fetch(API_URL)
const data = await response.json()
console.log(data)
}
getAll()
const API_URL = "https://nihatapi.vercel.app/users"
axios.get(API_URL).then (response => {
console.log(data)
})
const API_URL = "https://nihatapi.vercel.app/users"
async function getALl (){
const response = await axios.get(API_URL)
console.log(response.data)
}
getAll()
GET ONE BY ID
const API_URL = "https://nihatapi.vercel.app/users/1"
fetch(API_URL).then( response => response.json() )
.then ( (data) => {
console.log(data)
} )
const API_URL = "https://nihatapi.vercel.app/users/1"
async function getAll (){
const response = await fetch(API_URL)
const data = await response.json()
console.log(data)
}
getAll()
const API_URL = "https://nihatapi.vercel.app/users/1"
axios.get(API_URL).then (response => {
console.log(data)
})
const API_URL = "https://nihatapi.vercel.app/users/1"
async function getALl (){
const response = await axios.get(API_URL)
console.log(response.data)
}
getAll()
ADD ONE
const API_URL = "https://nihatapi.vercel.app/users/1"
fetch(API_URL).then( response => response.json() )
.then ( (data) => {
console.log(data)
} )
const API_URL = "https://nihatapi.vercel.app/users/1"
async function getAll (){
const response = await fetch(API_URL)
const data = await response.json()
console.log(data)
}
getAll()
const API_URL = "https://nihatapi.vercel.app/users/1"
axios.get(API_URL).then (response => {
console.log(data)
})
const API_URL = "https://nihatapi.vercel.app/users/1"
async function getALl (){
const response = await axios.get(API_URL)
console.log(response.data)
}
getAll()
UPDATE ONE
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { username : 'debug' }
fetch(API_URL,obj).then( response => response.json() )
.then ( (data) => {
console.log(data)
} )
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { username : 'debug' }
async function getAll (){
const response = await fetch(API_URL,{username : "debug"})
const data = await response.json()
console.log(data)
}
getAll()
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { firstName : 'debug' }
axios.get(API_URL,{username: "debug"}).then (response => {
console.log(data)
})
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { firstName : 'debug' }
async function getAll (){
const response = await axios.get(API_URL,'debug')
console.log(response.data)
}
getAll()
DELETE ONE
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { username : 'debug' }
fetch(API_URL,obj).then( response => response.json() )
.then ( (data) => {
console.log(data)
} )
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { username : 'debug' }
async function getAll (){
const response = await fetch(API_URL,{username : "debug"})
const data = await response.json()
console.log(data)
}
getAll()
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { firstName : 'debug' }
axios.get(API_URL,{username: "debug"}).then (response => {
console.log(data)
})
const API_URL = "https://nihatapi.vercel.app/users/"
const obj = { firstName : 'debug' }
async function getAll (){
const response = await axios.get(API_URL,'debug')
console.log(response.data)
}
getAll()