mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-31 06:59:33 +02:00
refactor contexts, format zod errors, and more refactoring
This commit is contained in:
parent
2635443105
commit
2852d62258
83 changed files with 2150 additions and 1264 deletions
|
@ -10,6 +10,7 @@ import logger from '@server/logger';
|
|||
import config from "@server/config";
|
||||
import { getUniqueExitNodeEndpointName } from '@server/db/names';
|
||||
import { findNextAvailableCidr } from "@server/utils/ip";
|
||||
import { fromError } from 'zod-validation-error';
|
||||
// Define Zod schema for request validation
|
||||
const getConfigSchema = z.object({
|
||||
publicKey: z.string(),
|
||||
|
@ -33,7 +34,7 @@ export async function getConfig(req: Request, res: Response, next: NextFunction)
|
|||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
parsedParams.error.errors.map(e => e.message).join(', ')
|
||||
fromError(parsedParams.error).toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue