メインコンテンツまでスキップ

演習

いきなりですが、演習です

このリポジトリをクローンして以下の手順を行ってください

https://github.com/matumoto1234/sccp-example

# リポジトリをクローン
git clone git@github.com:matumoto1234/sccp-example.git

# フロントのディレクトリに移動
cd sccp-example/lec09/todo-sample

# 必要なライブラリをインストール
npm install

# localhostで動かしてみる
npm run dev

上記の手順通りにnpm run devを実行すると、エラーになって動かないと思います
これは、APIサーバーが未実装なためリクエストの段階で失敗しているためです
そこで、このTODOアプリを動かすのに必要なAPIサーバーを作ってもらいます

仕様は以下のコードをhttps://editor.swagger.io/ にコピペして見てください

openapi: 3.0.0
info:
version: 1.0.0
title: sccp lec09 API

paths:
/todo-list:
get:
tags:
- todo list
description: >
全てのTodoを取得する
responses:
"200":
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Todo"

/todo:
post:
tags:
- todo
description: >
Todoを作成する
parameters:
- name: title
description: string
required: true
- name: description
description: string
required: true
- name: status
description: string
required: true
responses:
"200":
description: OK


components:
schemas:
Todo:
type: "object"
properties:
id:
type: "string"
title:
type: "string"
description:
type: "string"
status:
type: "string"
example: "done"