Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/note.picotech.app/public_html/src/routes/ drwxr-xr-x | |
| Viewing file: Select action/file-type: const express = require('express');
const { body, param } = require('express-validator');
const {
getLabels,
getLabel,
createLabel,
updateLabel,
deleteLabel,
} = require('../controllers/labelController');
const { authenticate } = require('../middleware/auth');
const router = express.Router();
// All routes require authentication
router.use(authenticate);
// Validation rules
const labelValidation = [
body('name')
.trim()
.isLength({ min: 1, max: 100 })
.withMessage('Label name must be between 1 and 100 characters'),
body('color')
.optional()
.matches(/^#[0-9A-F]{6}$/i)
.withMessage('Color must be a valid hex color code (e.g., #FF0000)'),
];
const labelIdValidation = [
param('id')
.isInt({ min: 1 })
.withMessage('Label ID must be a positive integer'),
];
// Routes
router.get('/', getLabels);
router.get('/:id', labelIdValidation, getLabel);
router.post('/', labelValidation, createLabel);
router.put('/:id', [...labelIdValidation, ...labelValidation], updateLabel);
router.delete('/:id', labelIdValidation, deleteLabel);
module.exports = router; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0031 ]-- |