Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DataFire-repos/contact-us-base
https://github.com/DataFire-repos/contact-us-base
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/DataFire-repos/contact-us-base
- Owner: DataFire-repos
- Created: 2017-08-17T18:42:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-11T20:50:37.000Z (almost 5 years ago)
- Last Synced: 2024-08-01T12:31:25.871Z (3 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - DataFire-repos/contact-us-base - (others)
README
# Contact Us Backend
This project creates a backend for a "Contact Us" form. It uses a Gmail account to send you an e-mail on behalf of someone else, e.g. a visitor to your site.
[Run this project on DataFire.io](https://app.datafire.io/projects?baseRepo=https:%2F%2Fgithub.com%2FDataFire-repos%2Fcontact-us-base)
## Running on DataFire.io
* Go to the **Integrations** tab, and add a new Gmail account.
* Select the `https://www.googleapis.com/auth/gmail.send` scope.
* Click "Add Account" and log into the Gmail account you want to send messages from
* Navigate to the **Actions** tab, and click on `contact_me`
* Replace `[email protected]` with your own email address
* Click "Deploy"
* Select `prod`
* Click "Deploy Project"## Running Manually
To run this project manually:
```bash
git clone https://github.com/DataFire-repos/contact-us-base
cd contact-us-base
npm install
datafire authenticate google_gmail
# Choose the gmail.send scope
# Edit ./actions/contact_me.js and replace [email protected] with your email address
datafire serve
```## Using the API
There is one URL for this API - `POST /contact`. It accepts both urlencoded and JSON content.
If you're running your project on DataFire.io, replace `http://localhost:3000` with your project's host, e.g. `https://project-name.prod.with-datafire.io`.
### HTML form
```html
```
### cURL
```bash
curl -X POST "http://localhost:3000/contact" \
-d 'message=hi&[email protected]'
``````bash
curl -X POST "http://localhost:3000/contact" \
-d '{"message": "hi!", "emailAddress": "[email protected]"}'
-H 'Content-Type: application/json'
```