feat: Add role-based access control tests and middleware integration
Some checks are pending
Docker Test / test (push) Waiting to run
Some checks are pending
Docker Test / test (push) Waiting to run
This commit is contained in:
parent
002bea51c3
commit
cab7146445
4 changed files with 55 additions and 11 deletions
|
|
@ -9,6 +9,7 @@ import contactRoutes from './routes/contacts.js';
|
|||
import profileRoutes from './routes/profile.js';
|
||||
// import { requestLogger } from './middleware/logger.js'; // Temporarily removed for compatibility
|
||||
import { rateLimit, authRateLimit } from '../middleware/rateLimit.cjs';
|
||||
import { requireRole } from '../middleware/role.middleware.js';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
|
@ -18,8 +19,8 @@ app.use(express.json());
|
|||
app.get('/health', (_req, res) => res.json({ status: 'ok' }));
|
||||
|
||||
// Test route for role middleware
|
||||
app.get('/test-role', (_req, res) => {
|
||||
res.status(200).json({ message: 'Test route for role middleware' });
|
||||
app.get('/test-role', requireRole(['user']), (_req, res) => {
|
||||
res.status(200).json({ message: 'Access granted to user role' });
|
||||
});
|
||||
|
||||
// Metrics endpoint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue