Skip to content

Commit 42975e9

Browse files
authored
Fix exercise of login (#665)
1 parent e6c8c62 commit 42975e9

File tree

5 files changed

+675
-7
lines changed

5 files changed

+675
-7
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

docs/3-web-servers/05-form/_samples/login/main.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const app = express();
44
app.use(express.static("static"));
55
app.use(express.urlencoded({ extended: true }));
66

7-
const PORT = 3000;
8-
97
const userCredentials = [
108
{ username: "tanaka", password: "kfae12F@" },
119
{ username: "sato", password: "faewbnpE3b=" },
@@ -18,8 +16,8 @@ app.post("/login", (request, response) => {
1816

1917
const userCredential = userCredentials.find(
2018
(userCredential) =>
21-
userCredential.username == username &&
22-
userCredential.password == password,
19+
userCredential.username === username &&
20+
userCredential.password === password,
2321
);
2422
if (userCredential === undefined) {
2523
response.send("ログインに失敗しました。");
@@ -28,4 +26,4 @@ app.post("/login", (request, response) => {
2826
}
2927
});
3028

31-
app.listen(PORT);
29+
app.listen(3000);

0 commit comments

Comments
 (0)