Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #507 as assigned to me in #332 #536

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/sg-webhooks-consumer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.env
npm-debug.log*
*.log
2 changes: 2 additions & 0 deletions packages/sg-webhooks-consumer/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: node index.js
dev: nodemon index.js --ignore client
50 changes: 50 additions & 0 deletions packages/sg-webhooks-consumer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## To Start Local Server -
A. Setting Up the server -

1. Install heroku-cli
2. Install nodemon with `npm i -g nodemon`
3. Run `npm i` to install the server-side dependencies
4. Run `touch .env` then open it and fill it like the sample .env file.
5. Run `npm start` and make sure the mongo instance is also running.

B. Setting Up the client -

1. Run `cd client ` in separate terminal to change into client directory.
2. In client directory run `npm i` to install client-side dependencies.
3. In client directory run `touch .env` and fill `stripePubKey=pk_test_--------------` in it .
4. In client directory run `npm start `.
5. Navigate to localhost:3000 in the browser.


Go to https://app.sendgrid.com/settings/mail_settings and enable Event Notification. There pass the callback url as `{hosturl}/api/surveys/webhooks`. Also check that click tracking is enabled.

## Sample .env file
```
NODE_ENV=development
port=5000
googleClientID=-------------.apps.googleusercontent.com
googleClientSecret=--------------
mongoURI=mongodb://localhost:27017/merndemodb
cookieKey=---------------
HOST_URL=http://localhost:5000
stripePubKey=pk_test_--------------
stripeSecretKey=sk_test_-------------
```

## Milestones
1. [x] Configure Express to work with React.js via Proxy.
2. [x] Google Oauth2.0 Api.
3. [x] Stripe payment Api.
4. [x] Setup production build to Heroku.
5. [x] Handle multiple env variables for both server and client.
6. [x] Use ES2017 syntax with async/await instead of promises.
7. [x] React with Redux architecture.
8. [x] Session Authentication with Passport.js and Cookies.
9. [x] Create Webhooks for Google and Stripe Apis.
10. [x] Database Management using MongoDB.

Note -
1. Heroku Cli is used for handling **environment variables** and deploys.
2. To get **googleClientID** and **googleClientSecret** make a new project at [here](https://console.developers.google.com) and enable the Google+ api.
3. To get **stripePubKey** and **stripeSecretKey** create account on [Stripe](http://stripe.com/).
4. If you don't have **mongodb** locally, then create a remote db [here](https://mlab.com/home)
21 changes: 21 additions & 0 deletions packages/sg-webhooks-consumer/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2,164 changes: 2,164 additions & 0 deletions packages/sg-webhooks-consumer/client/README.md

Large diffs are not rendered by default.

Loading