Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/ravens
node.js contact form handler using Mailgun and ReCaptcha
https://github.com/binocarlos/ravens
Last synced: 10 days ago
JSON representation
node.js contact form handler using Mailgun and ReCaptcha
- Host: GitHub
- URL: https://github.com/binocarlos/ravens
- Owner: binocarlos
- License: mit
- Created: 2014-02-24T15:31:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-13T13:44:30.000Z (over 10 years ago)
- Last Synced: 2024-10-01T19:21:20.688Z (about 2 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ravens
======node.js contact form handler using ReCaptcha
## installation
```
$ npm install ravens
```## usage
```js
var Ravens = require('ravens');var ravens = Ravens({
recaptcha_public_key:'...',
recaptcha_private_key:'...'
})ravens.on('send', function(formdata){
// this formdata has been validated by ReCaptcha
// you can use it to send an email or do whatever})
var app = express();
// mount the form submit route onto the express application
app.use('/contactsubmit', ravens.handler());
```## Ravens(appconfig)
create a new express handler with the following properties:
* recaptcha_public_key - the public key for your recaptcha account
* recaptcha_private_key - the private key for your recaptcha account## events
these events are emitted by a ravens instance:
### emit('send', formdata)
gives a chance to mess with the formdata before the emails are sent
## form data
When you submit formdata to the handler - the request body must be JSON and must contain the following fields:
* recaptcha_challenge_field
* recaptcha_response_fieldThese are acquired by using the [ReCaptcha client libraries](https://www.google.com/recaptcha/admin/create).
There is an angular plugin for Ravens that renders a nice contact form with Recaptcha Plugin built in - [ng-ravens](https://github.com/binocarlos/ng-ravens).
### license
MIT