Skip to content

Commit

Permalink
10 webhook for writing (#36)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
Type-Style authored Jan 24, 2024
1 parent 81cac92 commit 3e1fbbd
Show file tree
Hide file tree
Showing 19 changed files with 5,339 additions and 1,242 deletions.
20 changes: 14 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@
"sourceType": "module",
"project": "tsconfig.json"
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"env": {
"node": true
"node": true,
"jest/globals": true
},
"plugins": ["jest", "@typescript-eslint"],
"rules": {
//'no-console': 'off',
//'import/prefer-default-export': 'off',
//'@typescript-eslint/no-unused-vars': 'warn',
//"no-console": "off",
//"import/prefer-default-export": "off",
//"@typescript-eslint/no-unused-vars": "warn"
"jest/no-conditional-expect": "off"
},
"ignorePatterns": ["dist"]
"ignorePatterns": ["dist", "jest.config.js"]

}
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run build:prod --if-present
- name: Start server and test server response
- name: Start server
run: |
npm start &
sleep 5 # Wait for server to start
curl localhost:80
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p) # Kill background jobs
fi
sleep 5 # Give server some time to start
- run: npm test
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"workbench.editor.enablePreview": false,
"editor.rename.enablePreview": false
}
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
modulePathIgnorePatterns: ['<rootDir>/dist/'],
moduleNameMapper: {
'^@src/(.*)$': '<rootDir>/src/$1',
},
};
Loading

0 comments on commit 3e1fbbd

Please sign in to comment.