Skip to content

Commit 3e1fbbd

Browse files
authored
10 webhook for writing (#36)
* [Change] #3 clean up npm scripts, to have clean folder before build * [Task] #10 created data types in typescript * [Temp] #10 created subroute for writing, and folder structure * [Change] #3 include to use relative paths from src folder in ts and node https://stackoverflow.com/questions/43281741/how-can-i-use-paths-in-tsconfig-json See comment from Remo H. Hansen with at least 100 upvoted * [Change] Update VSCode to keep files open * [Task] #18 setup dotenv for secret variables * [Temp, Task] #10 Validate inputs using express-validator and custom functions * [Task] #18 prevent parameter pollution * [Task] #10 validating incoming parameter and logging errors * [Task] #7 add basic cache to express * [Changes] #7 Error Handling, to include basic custom Error Handling * [Task] #10 enhanced validation to only allow known parameters * [Change] #35 added Jest, tests for helper functions when writing * [Task] #10 better error Handling * [Task] #35 add tests for writing webhook validation * [TASK] #18 protect Webhook using KEY * [Fix] #35 test know import path structure now * [Task] #35 add test for protected webhook * [Task] #35 refactor build to run jest tests * [Task] #10 switched to crypto instead of bcrypt for dependency issue see synk inflight * [Fix] #36 PRQ Feedback
1 parent 81cac92 commit 3e1fbbd

File tree

19 files changed

+5339
-1242
lines changed

19 files changed

+5339
-1242
lines changed

.eslintrc.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66
"sourceType": "module",
77
"project": "tsconfig.json"
88
},
9-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
9+
"extends": [
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:jest/recommended"
13+
],
1014
"env": {
11-
"node": true
15+
"node": true,
16+
"jest/globals": true
1217
},
18+
"plugins": ["jest", "@typescript-eslint"],
1319
"rules": {
14-
//'no-console': 'off',
15-
//'import/prefer-default-export': 'off',
16-
//'@typescript-eslint/no-unused-vars': 'warn',
20+
//"no-console": "off",
21+
//"import/prefer-default-export": "off",
22+
//"@typescript-eslint/no-unused-vars": "warn"
23+
"jest/no-conditional-expect": "off"
1724
},
18-
"ignorePatterns": ["dist"]
25+
"ignorePatterns": ["dist", "jest.config.js"]
26+
1927
}

.github/workflows/build.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ jobs:
1818
- uses: actions/checkout@v3
1919
- run: npm ci
2020
- run: npm run build:prod --if-present
21-
- name: Start server and test server response
21+
- name: Start server
2222
run: |
2323
npm start &
24-
sleep 5 # Wait for server to start
25-
curl localhost:80
26-
if [ -n "$(jobs -p)" ]; then
27-
kill $(jobs -p) # Kill background jobs
28-
fi
24+
sleep 5 # Give server some time to start
25+
- run: npm test

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"workbench.editor.enablePreview": false,
3+
"editor.rename.enablePreview": false
4+
}

jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
modulePathIgnorePatterns: ['<rootDir>/dist/'],
6+
moduleNameMapper: {
7+
'^@src/(.*)$': '<rootDir>/src/$1',
8+
},
9+
};

0 commit comments

Comments
 (0)