Set up backend API server with Express and Prisma
- Initialize Node.js/Express backend project structure - Configure TypeScript for backend development - Set up Prisma ORM with MySQL database schema - Implement authentication middleware with Clerk - Create photo upload endpoint with EXIF extraction - Build report CRUD endpoints (create, read, delete) - Add file upload handling with Multer - Configure CORS and security middleware (helmet) - Set up error handling and validation - Create development environment configuration Task 21 complete: Backend foundation ready for report submissions
This commit is contained in:
17
server/src/routes/reportRoutes.ts
Normal file
17
server/src/routes/reportRoutes.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Router } from 'express';
|
||||
import { reportController } from '../controllers/reportController';
|
||||
import { requireAuth } from '../middleware/auth';
|
||||
import { upload } from '../middleware/upload';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// Photo upload endpoint (protected)
|
||||
router.post('/upload', requireAuth, upload.single('photo'), reportController.uploadPhoto.bind(reportController));
|
||||
|
||||
// Report CRUD endpoints
|
||||
router.post('/', requireAuth, reportController.createReport.bind(reportController));
|
||||
router.get('/', reportController.getReports.bind(reportController));
|
||||
router.get('/:id', reportController.getReportById.bind(reportController));
|
||||
router.delete('/:id', requireAuth, reportController.deleteReport.bind(reportController));
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user