mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2026-01-25 06:04:05 +00:00
MASSIVE commit
- moved to typescript - axios rate limitmodule is busted, removed for now, do something else for that - sequelize-typescript - dotenv, not dotenv-flow - removed playlist details route types for API ton of minor fixes and improvements
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import curriedLogger from "../utils/logger.js";
|
||||
const logger = curriedLogger(import.meta);
|
||||
|
||||
import * as typedefs from "../typedefs.js";
|
||||
|
||||
/**
|
||||
* @param {typedefs.Req} req
|
||||
* @param {typedefs.Res} res
|
||||
*/
|
||||
export const __controller_func = async (req, res) => {
|
||||
try {
|
||||
|
||||
} catch (error) {
|
||||
res.status(500).send({ message: "Internal Server Error" });
|
||||
logger.error("__controller_func", { error });
|
||||
return;
|
||||
}
|
||||
}
|
||||
16
boilerplates/controller.ts
Normal file
16
boilerplates/controller.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { RequestHandler } from "express";
|
||||
|
||||
import curriedLogger from "../utils/logger.ts";
|
||||
const logger = curriedLogger(import.meta.filename);
|
||||
|
||||
const __controller_func: RequestHandler = async (req, res) => {
|
||||
try {
|
||||
return null;
|
||||
} catch (error) {
|
||||
res.status(500).send({ message: "Internal Server Error" });
|
||||
logger.error("__controller_func", { error });
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export { __controller_func };
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Router } from "express";
|
||||
const router = Router();
|
||||
|
||||
import { validate } from "../validators/index.js";
|
||||
|
||||
router.get(
|
||||
|
||||
);
|
||||
|
||||
router.post(
|
||||
|
||||
);
|
||||
|
||||
export default router;
|
||||
10
boilerplates/route.ts
Normal file
10
boilerplates/route.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Router } from "express";
|
||||
const router: Router = Router();
|
||||
|
||||
import { validate } from "../validators/index.ts";
|
||||
|
||||
router.get("");
|
||||
|
||||
router.post("");
|
||||
|
||||
export default router;
|
||||
@@ -1,17 +0,0 @@
|
||||
import { body, header, param, query } from "express-validator";
|
||||
|
||||
import * as typedefs from "../typedefs.js";
|
||||
|
||||
/**
|
||||
* @param {typedefs.Req} req
|
||||
* @param {typedefs.Res} res
|
||||
* @param {typedefs.Next} next
|
||||
*/
|
||||
export const __validator_func = async (req, res, next) => {
|
||||
await body("field_name")
|
||||
.notEmpty()
|
||||
.withMessage("field_name not defined in body")
|
||||
.run(req);
|
||||
|
||||
next();
|
||||
}
|
||||
13
boilerplates/validator.ts
Normal file
13
boilerplates/validator.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { RequestHandler } from "express";
|
||||
import { body, header, param, query } from "express-validator";
|
||||
|
||||
const __validator_func: RequestHandler = async (req, _res, next) => {
|
||||
await body("field_name")
|
||||
.notEmpty()
|
||||
.withMessage("field_name not defined in body")
|
||||
.run(req);
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
export { __validator_func };
|
||||
Reference in New Issue
Block a user