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

13
nodemon.json Normal file
View File

@@ -0,0 +1,13 @@
{
"ignore": [
"src/**/*.test.ts",
"src/**/*.spec.ts",
".git",
"node_modules"
],
"watch": [
"src"
],
"exec": "npm start",
"ext": "ts"
}

1924
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,9 +5,10 @@
"main": "./src/main.ts",
"private": true,
"scripts": {
"dev": "ts-node ./src/main.ts",
"build": "tsc",
"start": "node ./dist/main.js"
"dev": "nodemon",
"build": "tsc -p ./",
"start": "ts-node ./src/main.ts",
"start:prod": "node ./dist/main.js"
},
"repository": {
"type": "git",
@@ -40,19 +41,21 @@
"morgan": "^1.10.0",
"mysql": "^2.18.1",
"nodemailer": "^6.6.3",
"uuid": "^8.3.2"
"uuid": "^8.3.2",
"mariadb": "^2.5.4",
"sequelize": "^6.6.5"
},
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/helmet": "^4.0.0",
"@types/morgan": "^1.9.3",
"@types/validator": "^13.6.3",
"babel-eslint": "^10.1.0",
"dotenv": "^8.6.0",
"eslint": "^7.31.0",
"eslint-plugin-import": "^2.23.4",
"mariadb": "^2.5.4",
"sequelize": "^6.6.5",
"nodemon": "^1.18.6",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
}

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

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'

9
tsconfig.build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"test",
"dist",
"**/*spec.ts"
]
}

View File

@@ -11,7 +11,7 @@
"sourceMap": true,
"outDir": "./dist",
"esModuleInterop": true,
"baseUrl": "./",
"baseUrl": "./src",
"incremental": true,
"types": [
"node",