Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
omer-bar committed Jul 4, 2022
0 parents commit 7fa2208
Show file tree
Hide file tree
Showing 70 changed files with 38,642 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
REACT_APP_FIREBASE_API_KEY=AIzaSyD6fza-PdmUiZi2h0zvzY-ZfQqHzLYNtXs
REACT_APP_FIREBASE_AUTH_DOMAIN=appointment-793e7.firebaseapp.com
REACT_APP_FIREBASE_DATABASE_URL=https://appointment-793e7.firebaseio.com
REACT_APP_FIREBASE_PROJECT_ID=appointment-793e7
REACT_APP_FIREBASE_STORAGE_BUCKET=appointment-793e7.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=105004083706
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "appointment-793e7"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
48 changes: 48 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const functions = require('firebase-functions')
const nodemailer = require('nodemailer')
const cors = require('cors')({
origin: true
})
const gmailEmail = functions.config().gmail.email
const gmailPassword = functions.config().gmail.password

const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
})

exports.submit = functions.https.onRequest((req, res) => {
res.set('Access-Control-Allow-Origin', '*')
res.set('Access-Control-Allow-Methods', 'GET, PUT, POST, OPTIONS')
res.set('Access-Control-Allow-Headers', '*')

if (req.method === 'OPTIONS') {
res.end()
} else {
cors(req, res, () => {
if (req.method !== 'POST') {
return
}

const mailOptions = {
from: req.body.email,
replyTo: req.body.email,
to: gmailEmail,
subject: `${req.body.subject}`,
text: req.body.message,
html: `<p>${req.body.message}</p>`,
}

return mailTransport.sendMail(mailOptions).then(() => {
console.log('New email sent to:', gmailEmail)
res.status(200).send({
isEmailSend: true
})
return
})
})
}
})
Loading

0 comments on commit 7fa2208

Please sign in to comment.