Git Product home page Git Product logo

homework2's Introduction

homework2

채팅 클라이언트 구현

주어진 채팅 서버( https://snu-web-random-chat.herokuapp.com/ )를 이용하여, 채팅 클라이언트를 구현한다. 서버 endpoint는 다음과 같다.

:POST /login { name }

-> { key, name, createdAt }

:GET /chats { createdAtFrom, createdAtTo, order }

-> [ { user, message, createdAt, }, { user, message, createdAt, }, { user, message, createdAt, }, ... ]

maximum 100 messages are loaded. You must use createdFrom, createdTo, order=(asc,desc) to load more messages.

for example,

{"_id":"5ddfae935f3e3500043a8da8","message":"","createdAt":1574940307945,"userName":"hihihihiihi"}

when last message is like that, you can load more messages by sending

https://snu-web-random-chat.herokuapp.com/chats?createdAtFrom=1574940307945

:POST /chats (auth_required)

-> { meesage, created }

  • auth_required 의 경우, /login 시 얻은 key를 http request header에 첨부하면 된다.
Authorization: Key sdfsdlfkje23rdsfsi9fergi

스펙

라이브러리

  • react 사용
  • react functional component 사용
  • fetch 사용
  • dayjs 사용해도되나, 사용하지 않아도 무방.
  • ui framework 1개 이상 사용.(material design, bootstrap...)

eslint 사용. airbnb | google (npx eslint --init) # 되도록 하는 걸 추천드리지만 늦게 추가된 부분이라 점수에는 반영하지 않겠습니다.

기능

  • 가벼운 카카오 오픈채팅방이라고 보면 됨
  • 로그인 안 한 상태에서 페이지 접근 시 채팅 데이터를 보여줌(오름차순). 채팅은 불가능.
  • 로그인 버튼을 누르면, name을 입력할 수 있고 입력하면. 로그인 완료.
  • 로그인 완료 시 채팅 입력 가능.
  • 3초에 한 번씩 서버 채팅 목록을 가져와, 새로운것이 있으면 업데이트 해줌.
  • 메시지 입력 완료 시, 서버에서 바로 채팅 목록 가져와서 refresh.
  • 로그인 이력이 있을 시, 자동으로 로그인 시도.

추가스펙

  • 로그아웃 기능
  • 최초 접근 시 채팅이 100개 이상 쌓였을 경우, 위로 스크롤 할 시에 대화 추가 로드.
  • 오프라인 모드에서 적절한 에러 핸들링

일정

  • 12월 8일 23:59:59 까지 etl을 통해 제출
  • 1일 늦을시 마다 10%씩 감점.

homework2's People

Contributors

realcom avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Jiwon Kang avatar ChanHyup Kim avatar

Forkers

yangbooom

homework2's Issues

자기가 한 말은 오른쪽에

나와야하는건가요 아니면 왼쪽에 다른 사람 채팅처럼 나와도 되는건가요??
오픈채팅을 한번도 안 써봐서 모르겠군요

eslint

eslint가 criteria에 없어서 안 한 상태로 제출했는데 criteria에 생겼더라고요..
이거 어떻게 해야되나요 ㅜㅜ

eslint

eslint는 안써도 되는건가요?
저번에 하나 추천?해주신다고 했는데 아직 안해주신거죠?

README 질문

GET /chats api 설명에서 parameter가 orderBy로 되어있는데 혼란의 여지가 있는것같습니다!

GET /chats API 질문

orderBy 파라미터를 asc, desc 둘 중 아무거나로 줘도 아무런 결과 변화가 없어서
최신 100개를 못 불러옵니다....

추가스펙

추가스펙이 해도되고 안해도되는 것이라는 것인가요~?
그리고 그 logout을 그냥 로컬스토리지에 있는거를 지워주는 형태로만 구현해도되는건가요? 아니면 진짜fetch로 delete request같은것을 보내줘야하는 것인가요??

/chats POST method에 body로 뭘 줘야하나요??

message랑 created를 주면 되는건가요...? return 해주는 값을 써주신 것 같은데 그럼 뭘 body로 넘겨줘야할지...
스펙 설명란에 login처럼 {name} 이런게 없어서 여쭤봅니다

3초 마다 업데이트 질문입니다.

3초마다 목록을 가져와서 새로운 것이 있으면 업데이트 하라고 하셨는데 3초마다 업데이트를 하면 되는 것인지, 아니면 3초마다 목록을 가져온 뒤 새로운 것이 없으면 업데이트를 하면 안되는 것인지 궁금합니다.

3초 마다 업데이트 질문입니다.

3초마다 목록을 가져와서 새로운 것이 있으면 업데이트 하라고 하셨는데 3초마다 업데이트를 하면 되는 것인지, 아니면 3초마다 목록을 가져온 뒤 새로운 것이 없으면 업데이트를 하면 안되는 것인지 궁금합니다.

scroll to bottom

채팅방 딱 처음 열자마자 프린트된후 scroll to bottom을 만들고 싶은데,
chats를 fetch한 후 return 을 chatMessage를 print하는거다 보니까 초기에 한번만 scroll to bottom하는 것이 어려운 것 같은데 혹시 조언 좀 주실 수 있으신가요?

print 다 된 후 한번만 window.scrollTo(0,document.body.scrollHeight); 하고 싶은데 print가 다 된걸 어떻게 다 알까요?? 그리고 어떻게 한번만 scrollTo 할 수 있는지 알 수 있을까요? 그냥 글로벌 변수 선언해서 flow 조절해도 되나요?

감사합니다,

제출 질문입니다

제출은 모든 내용을 압축해서 제출하면 되나요?? node_modules 폴더는 지울까요?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.