Skip to content
dinosat edited this page Oct 12, 2023 · 2 revisions

Backend with DTO API

Description

The Backend with DTO API is a RESTful web service that allows you to manage products, users, shopping carts, and more. It is built using Spring Boot and employs JWT (JSON Web Tokens) for authentication and authorization.

Table of Contents

Endpoints

Here are the main endpoints of the API:

  • /products: Manage products (CRUD operations).
  • /users: Manage users (CRUD operations).
  • /api/shopping-cart: Manage shopping carts and items (CRUD operations).
  • /auth: Authentication and authorization endpoints.

For detailed information about each endpoint, refer to the API Documentation.

Authentication

This API uses JWT (JSON Web Tokens) for authentication and authorization. To access protected endpoints, you need to obtain a JWT token by authenticating with valid credentials.

Authentication Endpoint

  • POST /auth/authenticate: Authenticate and obtain a JWT token.

Authorization

The API supports different user roles, including:

  • USER
  • ADMIN
  • ANONYMOUS

Each endpoint may have specific role requirements for access. Ensure you have the appropriate role when making requests.

Getting Started

To get started with the Backend with DTO API, follow these steps:

  1. Prerequisites:

    • Java 17
    • Spring Boot
    • Maven (or your preferred build tool)
  2. Clone the Repository:

    git clone https://github.com/your-repo/backend-with-dto.git
    cd backend-with-dto
  3. Configure Database:

    • Configure your database settings in application.properties or application.yml.
spring.datasource.url=jdbc:mysql://localhost:3306/your_database
spring.datasource.username=your_username
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

4.Build and Run:

mvn spring-boot:run