Wecode - Foundation 1 (부트캠프)/Foundation 1 마무리 퀴즈

Foundation 1- quiz 3. replit [Node.js]

Queen Julia 2023. 9. 5. 21:17

## 03. CRUD (create)

feed 데이터를 생성할 수 있게 만들어주세요.
feed 데이터를 생성하는 함수는 app.js 상단에서 불러오는 `createFeed` 함수를 이용해주세요.

### 요구 사항

- feed 를 생성하는 express API를 구현해주세요.
- mock-database.js 파일의 createFeed 함수를 파악한 후 req.body 에 들어올 데이터를 결정해주세요.

 

//body {
  "author": {
    "profileImage": string,
    "name": string
  },
  "title": string,
  "contents": string,
  "images": string[]
}

 

//function createFeed(createFeedDto) {
  const { author, title, content, images } = createFeedDto;

 

//app.post('/feed', (req, res) => {
const createFeedDto= req.body;


- createFeed 매개변수를 적절하게 넘겨주세요.

  // feed를 생성할 수 있게 매개변수를 넘겨주세요.
  createFeed(createFeedDto);

### 요청, 응답 인터페이스

```javascript
// feed post 요청
http://localhost:10010/feed
body {
  "author": {
    "profileImage": string,
    "name": string
  },
  "title": string,
  "contents": string,
  "images": string[]
}