FormUp API allows you to verify the entries of a contact form and also the user response token provided by reCAPTCHA client-side integration into your site. Once verified, the contact information will be sent via email.
Features
-
Validations
-
Form Entries
-
Name
-
Lastname
-
Email
-
Number/t.me
-
Message
-
-
reCAPTCHA Token
-
-
CORS
-
Routers
-
Controllers
-
Email Sending
Tech Stack
-
Runtime Environment
-
Environment Variables
-
Web Framework
-
CORS Policy
-
Response Compression
-
HTTP Headers
-
Rate Limiting
-
Email
-
Colors & Styles
-
ASCII Art
-
HTTP Client
-
Automatic Restart
Environment Variables
Variable | Value | Description |
---|---|---|
CLIENT_URL |
String | Required. Add to list of domains allowed by CORS |
RECAPTCHA_PRIVATE_KEY |
Private/Public Site Key | Required. Private Site Key for verifying client response and Public Site Key for reCAPTCHA client-side integration |
EMAIL_HOST EMAIL_PORT EMAIL_USER EMAIL_PASS |
SMTP Server | Required. You can use Mailtrap for testing or your own SMTP Server |
TO_EMAIL |
String | Required. Email address to which contact information will be sent |
Run
Install required
Locally
Clone the repository
-
HTTPS
git clone https://github.com/nostalcade/formup-api.git
-
SSH
git clone [email protected]:nostalcade/formup-api.git
Go to the repository directory
cd formup-api/
Install dev/Dependencies
npm i
Add Environment Variables to .env
file
- You must replace "somevalue" with your own values.
echo $'CLIENT_URL=somevalue\n\nRECAPTCHA_PRIVATE_KEY=somevalue\n\nEMAIL_HOST=somevalue\nEMAIL_PORT=somevalue\nEMAIL_USER=somevalue\nEMAIL_PASS=somevalue\n\nTO_EMAIL=somevalue' >> .env
Clear Bash History
history -cw
Start dev server
npm run dev
API base path URL on Server
http://localhost:5172/api/v1
All-In-One
-
HTTPS
git clone https://github.com/nostalcade/formup-api.git; cd formup-api/; npm i; echo $'CLIENT_URL=somevalue\n\nRECAPTCHA_PRIVATE_KEY=somevalue\n\nEMAIL_HOST=somevalue\nEMAIL_PORT=somevalue\nEMAIL_USER=somevalue\nEMAIL_PASS=somevalue\n\nTO_EMAIL=somevalue' >> .env; history -cw; npm run dev;
-
SSH
git clone [email protected]:nostalcade/formup-api.git; cd formup-api/; npm i; echo $'CLIENT_URL=somevalue\n\nRECAPTCHA_PRIVATE_KEY=somevalue\n\nEMAIL_HOST=somevalue\nEMAIL_PORT=somevalue\nEMAIL_USER=somevalue\nEMAIL_PASS=somevalue\n\nTO_EMAIL=somevalue' >> .env; history -cw; npm run dev;
API Reference
Index
-
Endpoints
-
Form
-
Publics
-
-
-
Errors
-
Express
-
Middlewares
-
-
Validations
-
Utils
-
Form Up
-
POST
/form/up
-
Request
-
Body
{ "name": "Sebastian", "lastname": "Lacoste", "email": "[email protected]", "number": "+1234567890", "message": "Example Message", "recaptchaToken": "00ANYoXqvI03P_WO1qXOHYrThd-ltX3jQ8HfQhDd5XT3jaSUe38ra9m9QF6yV8Example-" }
-
-
Response
-
Body
-
Successfully
-
(200)
{ "msg": "Successfully Sent" }
-
-
Errors
-
(400)
-
(403)
-
(500)
-
-
-
-
Invalid Route
-
ALL
/all-undefined
-
Response
-
Body
-
Errors
-
(404)
{ "msg": "Invalid Route" }
-
-
-
-
Verify Data
-
Response
-
Body
-
Errors
-
(400)
{ "msg": "Empty Object" }
{ "msg": "Invalid Properties" }
{ "msg": "Missing Properties" }
{ "msg": "Invalid reCAPTCHA" }
{ "msg": "Values length max. 200 characters" }
{ "msg": "Invalid Characters" }
{ "msg": "Invalid Email" }
-
-
-
reCAPTCHA
-
Response
-
Body
-
Errors
-
(403)
{ "msg": "Unsuccessfully reCAPTCHA" }
-
-
-
Nodemailer
-
Response
-
Body
-
Errors
-
(500)
{ "msg": "Unsuccessfully. Please try again" }
-
-
-