Skip to content

Commit

Permalink
NodeJs Forms: Fix route paths for consistency (#28544)
Browse files Browse the repository at this point in the history
* fix createUser path link

* remove 'users' from other paths
  • Loading branch information
jimmyli123 authored Aug 1, 2024
1 parent 6272b9f commit 3265b6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nodeJS/express/forms_and_data_handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Let's create a simple HTML form, with a single text field for collecting a full
The HTML structure would look something like this:

```html
<form action="/users/create" method="POST" >
<form action="/create" method="POST" >
<label for="fullName">Full Name:</label>
<input placeholder="John Doe" type="text" name="fullName" id="fullName">
<button type="submit">Submit</button>
Expand Down Expand Up @@ -180,8 +180,8 @@ const usersRouter = Router();
const usersController = require("../controllers/usersController");

// User update routes
usersRouter.get("/users/:id/update", usersController.userUpdateGet);
usersRouter.post("/users/:id/update", usersController.userUpdatePost);
usersRouter.get("/:id/update", usersController.userUpdateGet);
usersRouter.post("/:id/update", usersController.userUpdatePost);

module.exports = usersRouter;
```
Expand Down Expand Up @@ -276,7 +276,7 @@ Next we'll create two views:
</head>
<body>
<h1><%= title %></h1>
<form action="/users/create" method="POST">
<form action="/create" method="POST">
<label for="firstName">First Name: </label>
<input type="text" name="firstName" id="firstName" required>
<label for="lastName">Last Name: </label>
Expand Down

0 comments on commit 3265b6c

Please sign in to comment.