Skip to content

Commit 928ae76

Browse files
authored
Merge pull request #54 from shogun444/feat/creator-route-constants
feat: add creator route constants and replace repeated route strings
2 parents bf021fc + 465517e commit 928ae76

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/constants/creator.constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// src/constants/creator.constants.ts
2+
// Centralized creator route segments used across modules.
3+
4+
/** Base path for creator collection routes. */
5+
export const BASE = '/creators';
6+
7+
/** Root segment for creator module routes. */
8+
export const ROOT = '/';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// src/modules/creator/creator.routes.ts
22
import { Router } from 'express';
33
import { listCreators } from './creator.controller';
4+
import { ROOT as CREATORS_ROOT } from '../../constants/creator.constants';
45

56
const router = Router();
67

@@ -9,6 +10,6 @@ const router = Router();
910
* @desc Get a paginated list of creators
1011
* @access Public
1112
*/
12-
router.get('/', listCreators);
13+
router.get(CREATORS_ROOT, listCreators);
1314

1415
export default router;

src/modules/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import authRouter from './auth/auth.routes';
33
import healthRouter from './health/health.routes';
44
import configRouter from './config/config.routes';
55
import creatorRouter from './creator/creator.routes';
6+
import { BASE as CREATORS_BASE } from '../constants/creator.constants';
67

78
const router = Router();
89

910
router.use('/health', healthRouter);
1011
router.use('/auth', authRouter);
1112
router.use('/config', configRouter);
12-
router.use('/creators', creatorRouter);
13+
router.use(CREATORS_BASE, creatorRouter);
1314

1415
export default router;

0 commit comments

Comments
 (0)