This is a TypeScript-based backend server using Express.js to handle form submissions.
- Clone the repository:
git clone https://github.com/daulatojha17/FormBackendAPI.git
cd formBackend
- Install dependencies:
npm install
- Create a .env file
PORT=3000
CORS_ORIGIN=*
- Start the server
npm run dev
- Endpoint:
/ping
- Method: GET
- Description: Checks if the server is running.
- Example:
http://localhost:3000/ping
- Endpoint:
/submit
- Method: POST
- Description: Submits a form with parameters
name
,email
,phone
,github_link
,stopwatch_time
. - Example:
http://localhost:3000/submit
- Body: JSON format with fields:
{ "name": "John Doe", "email": "john@example.com", "phone": "123-456-7890", "github_link": "https://github.com/johndoe", "stopwatch_time": "1:30:00" }
- Endpoint:
/read
- Method: GET
- Description: Reads a form submission by index (0-indexed).
- Example:
http://localhost:3000/read?index=0
- Endpoint:
/edit/:ind
- Method: PUT
- Description: Edits a form submission by index (0-indexed).
- Example:
http://localhost:3000/edit/0
- Endpoint:
/delete/:ind
- Method: DELETE
- Description: Deletes a form submission by index (0-indexed).
- Example:
http://localhost:3000/delete/0
- Endpoint:
/delete?email=sample@gmail.com
- Method: GET
- Description: Searches a form submission by email.
- Example:
http://localhost:3000/search?email=sample@gmail.com