작삼은 작심 삼일이라는 뜻으로, 할 일을 목표 날짜와 함께 관리할 수 있는 웹 어플리케이션 입니다.
npm i
를 입력해 필요한 라이브러리를 설치합니다.- express, dotenv, mongodb, ejs
- nodemon, prettier
.env
파일을 생성하고 아래 내용을 입력합니다.DB_URL=# Mongo DB URL DB_USER=# Mongo DB Username DB_PASSWORD=# Mongo DB Password
npm run dev
를 입력해 서버를 실행합니다.
API는
/api
엔드포인트에서 시작됩니다.
전체 포스트 목록을 반환합니다.
https://example.com/api/post
Post 리스트를 반환합니다.
[
{
_id: string,
title: string,
dateOfCreate: string,
dateOfGoals: string,
todoDetail: string,
},
];
ID에 해당하는 하나의 Post를 반환합니다.
https://example.com/api/post/{id}
id
: Post의 고유 아이디 입니다.
ID에 해당하는 Post를 반환합니다.
{
_id: string;
title: string;
dateOfCreate: string;
dateOfGoals: string;
todoDetail: string;
}
새로운 Post를 생성합니다.
https://example.com/api/post
- Content-Type: application/json
{
title: string;
dateOfCreate: string;
dateOfGoals: string;
todoDetail: string;
}
저장된 Post의 ID 및 redirectUrl을 반환합니다.
{
insertedId: string;
redirectUrl: "/list";
}
수정된 Post 내용을 저장합니다.
https://example.com/api/post/{id}
id
: Post의 고유 아이디 입니다.
- Content-Type: application/json
{
title: string;
dateOfCreate: string;
dateOfGoals: string;
todoDetail: string;
}
저장된 Post에 대한 redirectUrl을 반환합니다.
{
redirectUrl: "/list";
}
ID에 해당하는 하나의 Post를 반환합니다.
https://example.com/api/post/{id}
id
: Post의 고유 아이디 입니다.
Status Code 중 204(No Content)를 반환합니다.