firt commit
This commit is contained in:
commit
c2e63830e1
71 changed files with 9613 additions and 0 deletions
32
server/routes/admin.js
Executable file
32
server/routes/admin.js
Executable file
|
@ -0,0 +1,32 @@
|
|||
import express from 'express';
|
||||
import multer from 'multer';
|
||||
import { addMatch, deleteMatch } from '../controllers/adminController.js'; // Assuming this controller file/function
|
||||
import { checkPassword, setPassword, verifyPassword } from '../controllers/authController.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Set up multer for file uploads
|
||||
const storage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
cb(null, './public/uploads/'); // Directory for uploaded files
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, `${Date.now()}-${file.originalname}`);
|
||||
}
|
||||
});
|
||||
const upload = multer({ storage: storage });
|
||||
|
||||
// Admin authentication routes
|
||||
router.get('/check-password', checkPassword);
|
||||
router.post('/set-password', setPassword);
|
||||
router.post('/verify-password', verifyPassword);
|
||||
|
||||
// Route to add a new match
|
||||
router.post('/matches', upload.array('pdfFiles'), addMatch);
|
||||
|
||||
// Route to delete a match
|
||||
router.delete('/matches/:id', deleteMatch);
|
||||
|
||||
// Add other admin routes here later (e.g., for status page)
|
||||
|
||||
export default router;
|
Loading…
Add table
Add a link
Reference in a new issue