Added nodemon scripts

This commit is contained in:
Alexis
2021-07-23 21:56:44 +02:00
parent a43b5a95c4
commit 681ff2b086
7 changed files with 1932 additions and 51 deletions

View File

@@ -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
};
};

View File

@@ -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'