Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 別ドメインからFetch APIを用いてリクエストを送信可能にするために必要
# WEB_ORIGINに設定したドメインからのリクエストのみを許可する
# 参考:https://developer.mozilla.org/ja/docs/Web/HTTP/Guides/CORS
WEB_ORIGIN="http://localhost:5173"
DATABASE_URL=""
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
/.env
/generated/prisma
/dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import express from "express";
import cors from "cors";
import { PrismaClient } from "./generated/prisma/index.js";

const app = express();
import { PrismaClient } from "@prisma/client";
const client = new PrismaClient();

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

app.use(express.json());

app.get("/todos", async (request, response) => {
Expand Down
Loading