code-Atish / codeEditor

1 stars 10 forks source link

feat: create routes #36

Open vaibhavvatsbhartiya opened 3 weeks ago

vaibhavvatsbhartiya commented 3 weeks ago

Your task is to create routes such that it can connect with the from and send a request to the data base.

as if we see in frontend page. find form component

Yashop181 commented 3 weeks ago

Hi @vaibhavvatsbhartiya,

I can create the routes to connect with the form and send requests to the database. To achieve this, I will need to create a few files and set up the backend with Express.js and MongoDB. Here are the steps I'll follow:

Create Form.js in the models folder. Create formController.js in the controllers folder to handle form submission logic. Create formRoutes.js in the routes folder to define the API routes. Update index.js to set up the server and connect to MongoDB.

Integrate Axios in the React frontend to send POST requests: Install Axios in the frontend project. Update the Form component to use Axios for sending form data to the backend.

Please let me know if you have any specific requirements or if there are any other tasks you'd like me to include.

chihab1991 commented 2 weeks ago

Your task is to create routes such that it can connect with the from and send a request to the data base.

as if we see in frontend page. find form component

* a post request is send from here,

* all data must be in json fromat,

* design a new model for from if needed

* and when we send post request using axios,

* data will store in data base.

I think we should do it step by step

  1. we specify our routes & types : get, post , ....
  2. specify data we should be sending from frontend.
  3. finally get the data needed from database and send it back to frontend.

so to create those routes you should specify routes and their types.

Yashop181 commented 2 weeks ago

Hi @chihab1991,

I am ready to work on the task involving the creation of routes to connect the form component with the database. Here is the plan for the implementation:

Specify Routes and Their Types:

GET /data: Retrieve data from the database. POST /submit: Submit data from the form to the database.

-Specify the Data to Send from Frontend:

All form data will be sent in JSON format. We will design a new model for the form data if needed.

-Create the Backend Logic:

Implement the routes in the backend. Use Axios to send a POST request from the frontend. Ensure the data is correctly stored in the database.

-Retrieve Data and Send it Back to Frontend:

Fetch the required data from the database. Send the data back to the frontend in the necessary format.

I will proceed step by step to ensure everything is set up correctly.

chihab1991 commented 2 weeks ago

Hi @chihab1991,

I am ready to work on the task involving the creation of routes to connect the form component with the database. Here is the plan for the implementation:

Specify Routes and Their Types:

GET /data: Retrieve data from the database. POST /submit: Submit data from the form to the database.

-Specify the Data to Send from Frontend:

All form data will be sent in JSON format. We will design a new model for the form data if needed.

-Create the Backend Logic:

Implement the routes in the backend. Use Axios to send a POST request from the frontend. Ensure the data is correctly stored in the database.

-Retrieve Data and Send it Back to Frontend:

Fetch the required data from the database. Send the data back to the frontend in the necessary format.

I will proceed step by step to ensure everything is set up correctly.

you should try to implement it.

Yashop181 commented 2 weeks ago

Hi @chihab1991,

I've completed the task of setting up POST routes to connect our form component with the database. I've also raised a pull request for your review.