David's API Playground

API Documentation:

https://davits-api.vercel.app/api/users

This endpoint allows you to perform CRUD operations on users. You can retrieve all users or create a new User using this endpoint.

GET - Retrieve All users

Retrieves all users from the database.

- GET

https://davits-api.vercel.app/api/users


fetch('https://davits-api.vercel.app/api/users', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
            

POST - Create a New User

Creates a new User with the provided data.

- POST

https://davits-api.vercel.app/api/users


fetch('https://davits-api.vercel.app/api/users', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    firstname: 'New User Name',
    lastname: 'New User Last Name',
    email: 'New User Email',
    password: 'New User Password
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
            

API Documentation:

https://davits-api.vercel.app/api/users/:id

This endpoint allows you to retrieve, update, or delete a specific User by its ID.

GET - Retrieve a User by ID

Retrieves a specific User by its ID.

- GET

https://davits-api.vercel.app/api/users/:id


fetch('https://davits-api.vercel.app/api/users/:id', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
            

PUT - Update a User by ID

Updates a specific User by its ID with the provided data.

- PUT

https://davits-api.vercel.app/api/users/:id


fetch('https://davits-api.vercel.app/api/users/:id', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    content: 'Updated User Content'
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
            

DELETE - Delete a User by ID

Deletes a specific User by its ID.

- DELETE

https://davits-api.vercel.app/api/users/:id


fetch('https://davits-api.vercel.app/api/users/:id', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));