Added nodemon scripts
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { NextFunction, Response } from "express";
|
||||
|
||||
const regexInt = RegExp(/^[1-9]\d*$/);
|
||||
const regexXSS = RegExp(/<[^>]*script/);
|
||||
|
||||
// Check if int for param validation
|
||||
const paramIntCheck = (req, res, next, input) => {
|
||||
const paramIntCheck = (req: Request, res: Response, next: NextFunction, input: any) => {
|
||||
try {
|
||||
if (regexInt.test(input)) {
|
||||
next();
|
||||
@@ -19,12 +21,12 @@ const paramIntCheck = (req, res, next, input) => {
|
||||
};
|
||||
|
||||
// Check if script injection attempt
|
||||
const isXSSAttempt = (string) => {
|
||||
const isXSSAttempt = (string: string) => {
|
||||
return regexXSS.test(string);
|
||||
};
|
||||
|
||||
// Check if object is null
|
||||
const isEmptyObject = (obj) => {
|
||||
const isEmptyObject = (obj: Object) => {
|
||||
return (Object.keys(obj).length === 0 && obj.constructor === Object);
|
||||
};
|
||||
|
||||
@@ -32,4 +34,4 @@ module.exports = {
|
||||
paramIntCheck,
|
||||
isXSSAttempt,
|
||||
isEmptyObject
|
||||
};
|
||||
};
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
// .env Data
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as dotenv from 'dotenv'
|
||||
dotenv.config();
|
||||
|
||||
// Packages
|
||||
import morgan from 'morgan';
|
||||
import helmet from 'helmet';
|
||||
import morgan from 'morgan'
|
||||
import helmet from 'helmet'
|
||||
import express from 'express'
|
||||
|
||||
import { AuracleApi } from './common/classes/AuracleApi'
|
||||
|
||||
Reference in New Issue
Block a user