Index

src/config/jwt.config.ts

accessJwtConfig
Type : JwtSignOptions
Default value : { secret: process.env.ACCESS_JWT_SECRET, expiresIn: '15m', }

Configurations for the access jsonwebtoken used for authentication

refreshJwtConfig
Type : JwtSignOptions
Default value : { secret: process.env.REFRESH_JWT_SECRET, expiresIn: '90d', }

Configurations for the refresh jsonwebtoken used for authentication

src/config/hash.config.ts

hashConfig
Type : object
Default value : { saltRounds: 10, }

Global configuration for amount of saltRounds on hashes of sensitive information

src/common/decorators/is-admin.decorator.ts

IS_ADMIN_KEY
Type : string
Default value : 'isAdmin'

Value to verify if @IsAdmin() is being used in the endpoint

Consult RolesGuard

src/auth/public.decorator.ts

IS_PUBLIC_KEY
Type : string
Default value : 'isPublic'

Value to verify if @Public() is being used in the endpoint

Consult JwtAuthGuard

Public
Default value : (): CustomDecorator => SetMetadata(IS_PUBLIC_KEY, true)

Makes an endpoint accessible by unauthenticated users


Example: Create user and Login endpoints

src/config/multer-upload.config.ts

maxImageUploadSize
Default value : 3 * 1024 * 1024

Constant that sets the maximum image upload file size

multerUploadConfig
Type : MulterOptions
Default value : { storage: diskStorage({ destination: './tmp', filename: (request, file, callback) => { const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9); const fileName = `${uniqueSuffix}-${file.originalname}`; return callback(null, fileName); }, }), fileFilter: (request, file, callback) => { const mimetype = validImageUploadTypesRegex.test(file.mimetype); const extname = validImageUploadTypesRegex.test( path.extname(file.originalname).toLowerCase(), ); if (mimetype && extname) { return callback(null, true); } return callback(new FileTypeError(validImageUploadTypesRegex), false); }, limits: { fileSize: maxImageUploadSize, }, }

Configurations for the multer library used for file upload.

Accepts types jpeg, jpg and png of size up to 3MB

validImageUploadTypesRegex
Default value : /jpeg|jpg|png/

Constant containing a Regular Expression with the valid image upload types

results matching ""

    No results matching ""