How to recreate a react project [closed]

Backend

package com.example.ecommerce.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//WebConfiguration

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/api/**")  // Apply CORS configuration to all endpoints under /api
                .allowedOrigins("http://localhost:5173")  // Allow requests from this origin
                .allowedMethods("GET", "POST", "PUT", "DELETE");  // Allow these methods
    }
}

Controllers

package com.example.ecommerce.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.ecommerce.entities.Producto;
import com.example.ecommerce.services.ProductoService;

import java.util.List;

//Los controladores manejan las solicitudes HTTP y llaman a los servicios correspondientes.

@RestController
@RequestMapping("/api/productos")
public class ProductoController {

@Autowired
private ProductoService productoService;

@GetMapping
public List<Producto> obtenerTodos(){
    return productoService.obtenerTodos();
}

@PostMapping
public Producto crearProducto(@RequestBody Producto producto){
    return productoService.crearProducto(producto);
}

}
Entities
package com.example.ecommerce.entities;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

@Entity
public class Producto {

//ACA SE DEFINEN LAS ENTIDADES JPA PARA LA CLASE PRODUCTO
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

private Long id;

private String nombre;
private Double precio;

public Producto(){
    
}

public Producto(String nombre, Double precio){
    this.nombre = nombre;
    this.precio = precio;
}

public Long getId(){
    return id;
}
public void setId(Long id){
    this.id = id;
}

public String getNombre(){
    return nombre;
}
public void setNombre(String nombre){
    this.nombre = nombre;
}

public Double getPrecio(){
    return precio;
}
public void setPrecio(Double precio){
    this.precio = precio;
}

}
Repository
package com.example.ecommerce.repositories;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import com.example.ecommerce.entities.Producto;

@Repository
public interface ProductoRepository extends JpaRepository<Producto, Long>{

}
Repository by Lucas
package com.example.uade.tpo.ecommerce.repositories;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.uade.tpo.ecommerce.entities.Artwork;

@Repository
public interface ArtworkRepository extends JpaRepository<Artwork, Long> {
@Query(value = "select a from Artwork a where a.artist = ?1")
public List<Artwork> findAllByUserId(Long id);
}
Services
package com.example.ecommerce.services;

import java.util.List;
import java.util.Optional;

import com.example.ecommerce.entities.Ruedas;

public interface RuedasService {
List<Ruedas> findAll();

Optional<Ruedas> findById(Long id);

Ruedas save(Ruedas ruedas);

void deleteById(Long id);

}
Services Impl
@Service
public class RuedasServiceImpl implements RuedasService {
@Autowired
private RuedasRepository ruedasRepository;

@Override
public List<Ruedas> findAll(){
    return ruedasRepository.findAll();
}

@Override
public Optional<Ruedas> findById(Long id){
    return ruedasRepository.findById(id);
}

@Override
public Ruedas save(Ruedas ruedas){
    return ruedasRepository.save(ruedas);
}

@Override
public void deleteById(Long id){
    ruedasRepository.deleteById(id);
}

}
application properties
server.port=8080

spring.datasource.url=jdbc:mysql://localhost:3306/practicafinal
spring.datasource.username=root
spring.datasource.password=Facundo2554
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

im trying to aprove an examn in the college`

New contributor

WebCrack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật