This is the backend server for the Slidely Form App, built with Express and TypeScript.
-
Clone the repository:
git clone https://github.com/ashishmohapatra240/slidely-backend.git cd slidely-backend
-
Install dependencies:
npm install
To start the server in development mode:
npm run dev
The server will start on http://localhost:3000.
slidely-backend/
├── src/
│ ├── controllers/
│ │ ├── formController.ts
│ ├── routes/
│ │ ├── formRoutes.ts
│ ├── services/
│ │ ├── formService.ts
│ ├── models/
│ │ ├── formModel.ts
│ ├── utils/
│ │ ├── db.ts
│ ├── index.ts
├── db.json
├── package.json
├── tsconfig.json
├── README.md
Description: Check if the server is running.
Response:
true
Description: Submit a new form entry.
Request Body:
{
"name": "John Doe",
"email": "[email protected]",
"phone": "9876543210",
"github_link": "https://github.com/john_doe/my_slidely_task/",
"stopwatch_time": "00:01:19"
}
Response (Success):
- Status Code: 201
- Body: Form submitted successfully
Response (Failure - Missing Fields):
- Status Code: 400
- Body: All fields are required
Description: Retrieve a specific form entry by index.
Query Parameters:
index
: The 0-based index of the form entry to retrieve.
Response (Success):
- Status Code: 200
- Body:
{ "name": "John Doe", "email": "[email protected]", "phone": "9876543210", "github_link": "https://github.com/john_doe/my_slidely_task/", "stopwatch_time": "00:01:19" }
Response (Failure - Invalid Index):
- Status Code: 400
- Body: Index must be a number
Response (Failure - Index Out of Range):
- Status Code: 404
- Body: Index out of range
Response (Failure - No Submissions):
- Status Code: 404
- Body: No submissions found
Description: Delete a specific form entry by index.
Query Parameters:
index
: The 0-based index of the form entry to delete.
Response (Success):
- Status Code: 200
- Body: Form deleted successfully
Response (Failure - Invalid Index):
- Status Code: 400
- Body: Index must be a number
Response (Failure - Index Out of Range):
- Status Code: 404
- Body: Index out of range
Response (Failure - No Submissions):
- Status Code: 404
- Body: No submissions found
Description: Edit a specific form entry by index.
Query Parameters:
index
: The 0-based index of the form entry to edit.
Request Body:
{
"name": "Updated Name",
"email": "[email protected]",
"phone": "1234567890",
"github_link": "https://github.com/updated_repo",
"stopwatch_time": "00:02:00"
}
Response (Success):
- Status Code: 200
- Body: Form updated successfully
Response (Failure - Missing Fields):
- Status Code: 400
- Body: All fields are required
Response (Failure - Invalid Index):
- Status Code: 400
- Body: Index must be a number
Response (Failure - Index Out of Range):
- Status Code: 404
- Body: Index out of range
Response (Failure - No Submissions):
- Status Code: 404
- Body: No submissions found
Description: Search form entries by email.
Query Parameters:
email
: The email ID to search for.
Response (Success):
- Status Code: 200
- Body:
[ { "name": "John Doe", "email": "[email protected]", "phone": "9876543210", "github_link": "https://github.com/john_doe/my_slidely_task/", "stopwatch_time": "00:01:19" } ]
Response (Failure - No Entries Found):
- Status Code: 404
- Body: No entries found for the provided email
Response (Failure - Invalid Email Parameter):
- Status Code: 400
- Body: Email must be a string
- GET /ping: Check server status.
- POST /submit: Submit a new form entry.
- GET /read: Retrieve a specific form entry by index.
- DELETE /delete: Delete a specific form entry by index.
- PUT /edit: Edit a specific form entry by index.
- GET /search: Search form entries by email.