Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Simple CRUD API with Spring Boot

This is a simple CRUD API of products.

Requirements

For building and running the application you need:

Running the application locally

There are several ways to run a Spring Boot application on your local machine. One way is to execute the main method in the com.example.springboot.SpringbootApplication class from your IDE.

Alternatively you can use the Spring Boot Maven plugin like so:

mvn spring-boot:run

Running the database with Docker

You need to run the database so the application can connect to it. To do so, run the following command:

docker-compose up -d

Testing endpoints

You can test the endpoints using Postman or Insomnia.

Creating a product

To create a product, you need to send a POST request to the following endpoint:

http://localhost:8080/products

The body of the request must be a JSON with the following structure:

{
  "name": "Product name",
  "price": 10.0
}

Getting all products

To get all products, you need to send a GET request to the following endpoint:

http://localhost:8080/products

Getting a product by uuid

To get a product by uuid, you need to send a GET request to the following endpoint:

http://localhost:8080/products/{uuid}

Updating a product

To update a product, you need to send a PUT request to the following endpoint:

http://localhost:8080/products/{uuid}

The body of the request must be a JSON with the following structure:

{
  "name": "Product name",
  "price": 10.0
}

Deleting a product

To delete a product, you need to send a DELETE request to the following endpoint:

http://localhost:8080/products/{uuid}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages