Skip to content

Commit

Permalink
Merge branch 'development' into Roberto_Create_Notification_For_Owner…
Browse files Browse the repository at this point in the history
…Admin_changes
  • Loading branch information
robertoooc committed Mar 30, 2024
2 parents 82f1e57 + b3599a4 commit 191a70e
Show file tree
Hide file tree
Showing 59 changed files with 25,212 additions and 4,737 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/dist
node_modules
launch.json
jest-env-vars.js
coverage
dist
15 changes: 12 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["eslint:recommended", "airbnb-base"],
"extends": ["eslint:recommended", "airbnb-base", "prettier"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 8,
Expand All @@ -16,11 +16,20 @@
"no-await-in-loop": "warn",
"template-curly-spacing": "off",
"indent": "off",
"linebreak-style": 0
"linebreak-style": 0,
"no-console": "off"
},
"settings": {
"import/resolver": {
"babel-module": {}
}
}
},
"overrides": [
{
"files": ["**/*.test.js", "**/*.spec.js", "src/test/*.js"],
"env": {
"jest": true
}
}
]
}
9 changes: 9 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
if ! head -1 "$1" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)!?(\(.+?\))?: .{1,}$"; then
echo "Aborting commit. Your commit message is invalid." >&2
exit 1
fi
if ! head -1 "$1" | grep -qE "^.{1,140}$"; then
echo "Aborting commit. Your commit message is too long." >&2
exit 1
fi
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx lint-staged --allow-empty
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.js": ["eslint --fix", "npm run test:staged", "prettier --write --ignore-unknown"]
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"tabWidth": 2,
"semi": true,
"endOfLine": "auto"
}
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# HGNRest

'npm install' to install the dependencies. 'npm start' to run the application
`npm install` to install the dependencies. `npm start` to run the application

To get started, make sure you have:
To get started, make sure you have:

1. Node v9.5 or higher installed on your machine.
2. A decent code editor like VS Code or Atom.
3. Git

Step1: Clone the App
To clone the code, navigate to the source directory where you want to maintain the code and via terminal or GUI of your choice, run : git clone https://github.com/OneCommunityGlobal/HGNRest.git . You can also setup SSH and then use that for working with remote.
To clone the code, navigate to the source directory where you want to maintain the code and via terminal or GUI of your choice, run : git clone https://github.com/OneCommunityGlobal/HGNRest.git . You can also setup SSH and then use that for working with remote.

Step2: Run npm install. Best way is to open the code in the editor and open integrated teminal. Run npm install.

Step3: Start the app: To start the app, you need to set up several process.env variables. These variables are:
Step3: If running on MacOS or Linux, run `npm run prepare`. This will install husky and allow integration with git hooks.

Step4: Start the app: To start the app, you need to set up several process.env variables. These variables are:
user=<user>
password=<password>
cluster=<clustername>
Expand All @@ -26,28 +28,27 @@ SMTPPort=<smtp port>
SMTPUser=<smtp user>
TOKEN_LIFETIME=<number>
TOKEN_LIFETIME_UNITS=<unit like days, second, hours etc>
JWT_SECRET=<secret value>
JWT_SECRET=<secret value>

To make the process easy create a .env file and put the above text in the file and replace values with the correct values, which you can get from your teammates. Then do an npm run-script build followed by an npm start. By default, the services will start on port 4500 and you can http://localhost:4500/api/<routename> to access the methods. A tools like Postman will be your best friend here, you will need to have an auth token placed in the 'Authorization' header which you can get through the networking tab of the local frontend when you login.

* `npm run lint` -- fix lint
* `npm run build` -- build src server and save in dist
* `npm run buildw` -- auto rebuild upon change of src
* `npm run start` -- run the server in dist
* `npm run serve` -- run the server in src without build
* `npm run dev` -- run the server in src and auto restart upon change of src
- `npm run lint` -- fix lint
- `npm run build` -- build src server and save in dist
- `npm run buildw` -- auto rebuild upon change of src
- `npm run start` -- run the server in dist
- `npm run serve` -- run the server in src without build
- `npm run dev` -- run the server in src and auto restart upon change of src

Note: Once you check in the code in github, the application will be publsihed to the following:
Developement : https://hgn-rest-dev.herokuapp.com
Note: Once you check in the code in github, the application will be publsihed to the following:
Developement : https://hgn-rest-dev.herokuapp.com
Master: https://hgn-rest.azurewebsites.net/

## BIG THANKS

- Monitoring and logging provided by [Sentry.io](https://sentry.io/welcome/)
- Hosting provided by [Microsoft Azure](https://azure.microsoft.com/en-us/) and [Heroku](https://www.heroku.com/)


Other key touchpoints:

Build and hosting: Azure and Heroku
Build and hosting: Azure and Heroku
Monitoring and logging: Sentry.io
4 changes: 4 additions & 0 deletions jest-integration.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const config = require('./jest.config');

config.testMatch = ['**/*.test.js'];
module.exports = config;
4 changes: 4 additions & 0 deletions jest-unit.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const config = require('./jest.config');

config.testMatch = ['**/*.spec.js'];
module.exports = config;
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: [
'!<rootDir>/src/**/*.js', // need to collect coverage from all files that are involved in serving an API request
'!<rootDir>/src/server.js',
'!<rootDir>/src/models/**/*.js',
'!<rootDir>/src/startup/**/*.js',
'!<rootDir>/src/test/**/*.js',
'!<rootDir>/src/utilities/**/*.js', // need to collect coverage from utilities after all unit tests have been created
],
coverageDirectory: 'coverage',
testEnvironment: 'node',
};
Loading

0 comments on commit 191a70e

Please sign in to comment.