Skip to content

Commit 1cc4fb1

Browse files
authored
Merge pull request #10 from u-na-gi/7-結果が見にくい
I improved the readability of the output.
2 parents 67a1a45 + 1d9e3b4 commit 1cc4fb1

File tree

27 files changed

+486
-909
lines changed

27 files changed

+486
-909
lines changed

.vscode/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"deno.enable": true,
3+
"deno.lint": true,
4+
"editor.defaultFormatter": "denoland.vscode-deno",
5+
"[typescriptreact]": {
6+
"editor.defaultFormatter": "denoland.vscode-deno"
7+
},
8+
"[typescript]": {
9+
"editor.defaultFormatter": "denoland.vscode-deno"
10+
},
11+
"[javascriptreact]": {
12+
"editor.defaultFormatter": "denoland.vscode-deno"
13+
},
14+
"[javascript]": {
15+
"editor.defaultFormatter": "denoland.vscode-deno"
16+
}
17+
}

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"workspace": {
33
"members": [
44
"scenario-flow",
5-
"example",
6-
"scenario-flow-cli"
5+
"scenario-flow-cli",
6+
"example"
77
]
88
}
99
}

deno.lock

Lines changed: 6 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tasks": {
3-
"dev": "deno run --watch main.ts",
3+
"server:start": "deno run -A --watch ./sample-api/server.ts",
44
"test": "deno run --allow-read --allow-run --allow-net ../scenario-flow-cli/main.ts ."
55
},
66
"imports": {

example/docker-compose.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

example/sample-api/server.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Deno.serve({
2+
port: 3323,
3+
hostname: "0.0.0.0",
4+
}, async (req) => {
5+
const url = new URL(req.url);
6+
7+
if (url.pathname === "/login") {
8+
if (req.method === "POST") {
9+
const body = await req.json();
10+
console.log("Request body:", body);
11+
12+
// Simulate a successful login response
13+
const response = {
14+
token: "sample-token-12345",
15+
};
16+
17+
return new Response(JSON.stringify(response), {
18+
status: 200,
19+
headers: {
20+
"Content-Type": "application/json",
21+
},
22+
});
23+
} else {
24+
return new Response("Method Not Allowed", { status: 405 });
25+
}
26+
} else if (url.pathname === "/api/data") {
27+
if (req.method === "GET") {
28+
const authorization = req.headers.get("Authorization");
29+
console.log("Authorization:", authorization);
30+
31+
if (!authorization || !authorization.startsWith("Bearer ")) {
32+
return new Response("Unauthorized", { status: 401 });
33+
}
34+
35+
// Simulate a successful login response
36+
const response = {
37+
data: "data from sample-api2",
38+
};
39+
40+
return new Response(JSON.stringify(response), {
41+
status: 200,
42+
headers: {
43+
"Content-Type": "application/json",
44+
},
45+
});
46+
} else {
47+
return new Response("Method Not Allowed", { status: 405 });
48+
}
49+
}
50+
51+
return new Response("Not Found", { status: 404 });
52+
});

example/sample-api1/README.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

example/sample-api1/deno.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)