Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms and Data Handling: Use single GET request and req.query for Search functionality #28640

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

DrantDumani
Copy link
Member

Because

This PR is meant to close issue #28585 which explains that POST is not ideal for search requests and that a GET request should be used instead.

This PR

  • The last paragraph of HTML Forms Overview states that data sent via a GET request is sent as a query string in the url itself.
  • The search method in Implement Searching says to only use a GET request.
  • It is explicitly stated that data sent via a GET request will not be available in req.body and that req.query should be used instead.

Issue

Closes #28585

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: NodeJS Involves the NodeJS course label Aug 15, 2024
Copy link
Contributor

@MaoShizhong MaoShizhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Prettier jumped in with its formatting, which does things very differently to our own style guide. Before I can review further, please could to undo all of the formatting changes and ensure you don't run Prettier on files in this repo? If you have it running on save, you should get very familiar with "save without formatting" or some alternative to formatting on save, as not every project will be compatible with it. This includes the / in the input tag on line 24 which is a classic Prettier behaviour (and is actually against the HTML5 spec).

Linting and formatting in this repo can be handled via the instructions in CONTRIBUTING.md

@DrantDumani
Copy link
Member Author

Thank you. I've disabled format on save in my vscode settings, and I undid all of prettier's format on save settings. Thank you for this, as I've gotten so used to just letting Prettier do its thing for a while now.

Copy link
Contributor

@MaoShizhong MaoShizhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, as another nit, the rogue extra space at the end of the opening form tag on line 22 can be removed as it shouldn't be there. Prettier did pick it up but came with a lot more than bargained for 😛

nodeJS/express/forms_and_data_handling.md Outdated Show resolved Hide resolved
Copy link
Contributor

@MaoShizhong MaoShizhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@MaoShizhong MaoShizhong merged commit a594c51 into TheOdinProject:main Aug 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: NodeJS Involves the NodeJS course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node: Update "Forms and Data Handling" lesson to use a single GET request for search functionality
2 participants