Skip to content

Commit 2b9479a

Browse files
committed
Cookie の節の書き直し
1 parent 83165fe commit 2b9479a

File tree

9 files changed

+1464
-5
lines changed

9 files changed

+1464
-5
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode"
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"[prisma]": {
4+
"editor.defaultFormatter": "Prisma.prisma"
5+
}
36
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
# Keep environment variables out of version control
3+
.env
4+
5+
/generated/prisma
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import express from "express";
2+
import { PrismaClient } from "./generated/prisma/index.js";
3+
4+
const app = express();
5+
const client = new PrismaClient();
6+
7+
app.use(express.json());
8+
app.use(express.static("./public"));
9+
10+
app.post("/login", async (request, response) => {
11+
const user = await client.user.findUnique({
12+
where: { username: request.body.username },
13+
});
14+
if (!user || user.password !== request.body.password) {
15+
response.sendStatus(401);
16+
return;
17+
}
18+
response.send(`ようこそ、${user.username}さん!`);
19+
});
20+
21+
app.listen(3000);

0 commit comments

Comments
 (0)