Skip to content

`Form-Data-To-Postgres` is a Node.js API designed to simplify the process of receiving client contact form submissions and persisting them in a PostgreSQL database. This backend service validates the received data from the client-side and stores it securely in a database for further processing or analysis.

License

Notifications You must be signed in to change notification settings

InabaKumori/Form-Data-To-Postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Name: Form-Data-To-Postgres

Description

Form-Data-To-Postgres is a Node.js API designed to simplify the process of receiving client contact form submissions and persisting them in a PostgreSQL database. This backend service validates the received data from the client-side and stores it securely in a database for further processing or analysis. It's a robust and efficient way to manage user-generated data coming from web forms.

Table of Contents

Installation

  1. Clone the repository to your local machine

    git clone https://github.com/InabaKumori/Form-Data-To-Postgres.git
  2. Navigate to the project folder

    cd Form-Data-To-Postgres
  3. Install required packages

    npm install
  4. Run the application

    node app.js

Usage

To test the API, make a POST request to http://localhost:30000/post/contact with the appropriate form data.

Here is a sample cURL request:

curl --location --request POST 'http://localhost:30000/post/contact' \
--form 'name="John Doe"' \
--form 'email="john.doe@email.com"' \
--form 'message="Hello, World!"'

API Endpoints

  • POST /post/contact: Endpoint for receiving form data.

Configuration

Create a .env file in the root directory of your project and add the following:

DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=your_database_name

Replace the placeholders with your actual PostgreSQL database information.

Database Setup

Here's an example SQL command to create the table:

CREATE TABLE contact_forms (
  id SERIAL PRIMARY KEY,
  name VARCHAR(100),
  email VARCHAR(100),
  message TEXT
);

Error Handling

Error responses come in the following JSON structure:

{
  "error": "Error message goes here"
}

Contributing

  1. Fork the project.
  2. Create your feature branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a pull request.

License

This project is licensed under the GNU License. See the LICENSE file for details.

Acknowledgments

  • Thanks to all contributors and their valuable input.
  • This project was inspired by the need for a simple, reliable way to manage client form submissions.

About

`Form-Data-To-Postgres` is a Node.js API designed to simplify the process of receiving client contact form submissions and persisting them in a PostgreSQL database. This backend service validates the received data from the client-side and stores it securely in a database for further processing or analysis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published