ShareIt is a Java-based application designed to facilitate the sharing of items among users. This documentation provides an overview of the project, installation instructions, usage guidelines, and details on the API endpoints.
To set up the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/LetaTreiden/java-shareit.git cd java-shareit -
Build the project:
Ensure you have Maven installed. Run the following command to build the project:
mvn clean install
-
Run the application:
Use the following command to run the application:
java -jar target/shareit-0.0.1-SNAPSHOT.jar
To use the ShareIt application, you need to interact with its API. Below are some examples of how to use the API.
Creating a new user:
POST /users
Content-Type: application/json
{
"name": "John Doe",
"email": "[email protected]"
}Listing all items:
GET /itemsAdding a new item:
POST /items
Content-Type: application/json
{
"name": "Lawn Mower",
"description": "A powerful lawn mower",
"available": true,
"ownerId": 1
}##User Endpoints Create a User
POST /users
Request Body: { "name": "string", "email": "string" }
Get All Users
GET /users
Get User by ID
GET /users/{id}
Update User
PUT /users/{id}
Request Body: { "name": "string", "email": "string" }
Delete User
DELETE /users/{id}
##Item Endpoints Create an Item
POST /items
Request Body: { "name": "string", "description": "string", "available": boolean, "ownerId": number }
Get All Items
GET /items
Get Item by ID
GET /items/{id}
Update Item
PUT /items/{id}
Request Body: { "name": "string", "description": "string", "available": boolean }
Delete Item
DELETE /items/{id}
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Commit your changes (git commit -am 'Add new feature').
- Push to the branch (git push origin feature-branch).
- Create a new Pull Request.
This project is licensed under the MIT License.