Skip to content

Commit 713d2fa

Browse files
authored
「React」の章の演習問題3の内容を最新にアップデート (#855)
1 parent e6d0332 commit 713d2fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5221
-5564
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 別ドメインからFetch APIを用いてリクエストを送信可能にするために必要
2+
# WEB_ORIGINに設定したドメインからのリクエストのみを許可する
3+
# 参考:https://developer.mozilla.org/ja/docs/Web/HTTP/Guides/CORS
4+
WEB_ORIGIN="http://localhost:5173"
5+
DATABASE_URL=""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/.env
3+
/generated/prisma
4+
/dist

docs/4-advanced/04-react/_samples/todo-database2/backend/main.ts renamed to docs/4-advanced/04-react/_samples/todo-database/backend/main.mts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import express from "express";
22
import cors from "cors";
3+
import { PrismaClient } from "./generated/prisma/index.js";
4+
35
const app = express();
4-
import { PrismaClient } from "@prisma/client";
56
const client = new PrismaClient();
67

7-
app.use(cors({ origin: process.env["WEB_ORIGIN"] }));
8+
// 別ドメインからFetch APIを用いてリクエストを送信可能にするために必要
9+
// WEB_ORIGINに設定したドメインからのリクエストのみを許可する
10+
// 参考:https://developer.mozilla.org/ja/docs/Web/HTTP/Guides/CORS
11+
app.use(cors({ origin: process.env.WEB_ORIGIN }));
12+
813
app.use(express.json());
914

1015
app.get("/todos", async (request, response) => {

0 commit comments

Comments
 (0)