/serverless-go-forms

Don't want to run PHP just to have a contact form? Send POST requests straight to a aws lambda instead

Primary LanguageGoMIT LicenseMIT

Serverless forms with go

The endpoint currently supports POSTS with JSON payloads in the following format:

{
    "from": "sender@example.com",
    "message": "Hello there"
}

Or application/x-www-form-urlencoded content in the format

from=sender@example.com&message=Hello%20there

If you need to change this format for your needs you can edit lib/types/types.go

Configuration

go-forms currently supports mailgun with plans to support slack and regular smtp or amazon sqs.

You can configure your mailgun keys by renaming config.example.yml -> config.dev.yml and entering your details.

If you want to create a production config use config.prod.yml

CORS

If you want to lock down the requests to just your dowmain use the cors.origin setting in serverless.yml

Building and Deploying

This project can be deployed with the serverless framework.

To build binaries for deployment run make before deploying.

You willl also need go dep to install the vendor dependencies.

npm install -g serverless
make
serverless deploy