Initial commit
This commit is contained in:
32
skills/backend-endpoint/templates/express-route-template.ts
Normal file
32
skills/backend-endpoint/templates/express-route-template.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* ${RESOURCE_NAME} Routes
|
||||
*
|
||||
* @route ${HTTP_METHOD} ${ROUTE_PATH}
|
||||
*/
|
||||
|
||||
import { Router, Request, Response, NextFunction } from 'express';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* ${HTTP_METHOD} ${ROUTE_PATH}
|
||||
* @description ${HTTP_METHOD} ${RESOURCE_NAME_LOWER}
|
||||
*/
|
||||
router.${HTTP_METHOD_LOWER}(
|
||||
'${ROUTE_PATH}',
|
||||
${MIDDLEWARE_CHAIN ? MIDDLEWARE_CHAIN + ',' : ''}
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
// TODO: Implement ${RESOURCE_NAME_LOWER} ${HTTP_METHOD_LOWER} logic
|
||||
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
data: {}, // Replace with actual data
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user