package com.bill.electricity.controller;
import com.bill.electricity.entity.Bill;
import com.bill.electricity.repository.BillRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api")
@CrossOrigin(origins = "*") // allows Angular frontend to call
public class BillController {
@Autowired
private BillRepository billRepository;
@GetMapping("/viewBills")
public ResponseEntity getAllBills() {
List bills = billRepository.findAll();
return ResponseEntity.ok(bills);
}
}
Submit your DMCA takedown request here to
report copyright infringement.